@@ -31,185 +31,185 @@ discard block |
||
| 31 | 31 | class modSubtotal extends DolibarrModules |
| 32 | 32 | { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
| 36 | - * |
|
| 37 | - * @param DoliDB $db Database handler |
|
| 38 | - */ |
|
| 34 | + /** |
|
| 35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
| 36 | + * |
|
| 37 | + * @param DoliDB $db Database handler |
|
| 38 | + */ |
|
| 39 | 39 | |
| 40 | - public function __construct($db) |
|
| 41 | - { |
|
| 42 | - global $langs, $conf; |
|
| 40 | + public function __construct($db) |
|
| 41 | + { |
|
| 42 | + global $langs, $conf; |
|
| 43 | 43 | |
| 44 | - $this->db = $db; |
|
| 44 | + $this->db = $db; |
|
| 45 | 45 | |
| 46 | 46 | $this->editor_name = 'ATM-Consulting'; |
| 47 | - // Id for module (must be unique). |
|
| 48 | - // Use a free id here |
|
| 49 | - // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
| 50 | - $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
| 51 | - // Key text used to identify module (for permissions, menus, etc...) |
|
| 52 | - $this->rights_class = 'subtotal'; |
|
| 47 | + // Id for module (must be unique). |
|
| 48 | + // Use a free id here |
|
| 49 | + // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
| 50 | + $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
| 51 | + // Key text used to identify module (for permissions, menus, etc...) |
|
| 52 | + $this->rights_class = 'subtotal'; |
|
| 53 | 53 | |
| 54 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
| 55 | - // It is used to group modules in module setup page |
|
| 56 | - $this->family = "technic"; |
|
| 57 | - // Module label (no space allowed) |
|
| 58 | - // used if translation string 'ModuleXXXName' not found |
|
| 59 | - // (where XXX is value of numeric property 'numero' of module) |
|
| 60 | - $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
| 61 | - // Module description |
|
| 62 | - // used if translation string 'ModuleXXXDesc' not found |
|
| 63 | - // (where XXX is value of numeric property 'numero' of module) |
|
| 64 | - $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
| 65 | - // Possible values for version are: 'development', 'experimental' or version |
|
| 66 | - $this->version = '3.1.10'; |
|
| 67 | - // Key used in llx_const table to save module status enabled/disabled |
|
| 68 | - // (where MYMODULE is value of property name of module in uppercase) |
|
| 69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 70 | - // Where to store the module in setup page |
|
| 71 | - // (0=common,1=interface,2=others,3=very specific) |
|
| 72 | - $this->special = 2; |
|
| 73 | - // Name of image file used for this module. |
|
| 74 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
| 75 | - // use this->picto='pictovalue' |
|
| 76 | - // If file is in module/img directory under name object_pictovalue.png |
|
| 77 | - // use this->picto='pictovalue@module' |
|
| 78 | - $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
| 79 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
| 80 | - // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
| 81 | - // for specific path of parts (eg: /titre/core/modules/barcode) |
|
| 82 | - // for specific css file (eg: /titre/css/titre.css.php) |
|
| 83 | - $this->module_parts = array( |
|
| 84 | - // Set this to 1 if module has its own trigger directory |
|
| 85 | - 'triggers' => 1, |
|
| 86 | - // Set this to 1 if module has its own login method directory |
|
| 87 | - //'login' => 0, |
|
| 88 | - // Set this to 1 if module has its own substitution function file |
|
| 89 | - //'substitutions' => 0, |
|
| 90 | - // Set this to 1 if module has its own menus handler directory |
|
| 91 | - //'menus' => 0, |
|
| 92 | - // Set this to 1 if module has its own barcode directory |
|
| 93 | - //'barcode' => 0, |
|
| 94 | - // Set this to 1 if module has its own models directory |
|
| 95 | - 'models' => 1, |
|
| 96 | - // Set this to relative path of css if module has its own css file |
|
| 97 | - //'css' => '/titre/css/mycss.css.php', |
|
| 98 | - // Set here all hooks context managed by module |
|
| 99 | - 'hooks' => array( |
|
| 100 | - 'invoicecard' |
|
| 101 | - ,'invoicesuppliercard' |
|
| 102 | - ,'propalcard' |
|
| 103 | - ,'supplier_proposalcard' |
|
| 104 | - ,'ordercard' |
|
| 105 | - ,'ordersuppliercard' |
|
| 106 | - ,'odtgeneration' |
|
| 107 | - ,'orderstoinvoice' |
|
| 108 | - ,'admin' |
|
| 109 | - ,'invoicereccard' |
|
| 110 | - ,'consumptionthirdparty' |
|
| 111 | - ,'ordershipmentcard' |
|
| 112 | - ,'expeditioncard' |
|
| 54 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
| 55 | + // It is used to group modules in module setup page |
|
| 56 | + $this->family = "technic"; |
|
| 57 | + // Module label (no space allowed) |
|
| 58 | + // used if translation string 'ModuleXXXName' not found |
|
| 59 | + // (where XXX is value of numeric property 'numero' of module) |
|
| 60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
| 61 | + // Module description |
|
| 62 | + // used if translation string 'ModuleXXXDesc' not found |
|
| 63 | + // (where XXX is value of numeric property 'numero' of module) |
|
| 64 | + $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
| 65 | + // Possible values for version are: 'development', 'experimental' or version |
|
| 66 | + $this->version = '3.1.10'; |
|
| 67 | + // Key used in llx_const table to save module status enabled/disabled |
|
| 68 | + // (where MYMODULE is value of property name of module in uppercase) |
|
| 69 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 70 | + // Where to store the module in setup page |
|
| 71 | + // (0=common,1=interface,2=others,3=very specific) |
|
| 72 | + $this->special = 2; |
|
| 73 | + // Name of image file used for this module. |
|
| 74 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
| 75 | + // use this->picto='pictovalue' |
|
| 76 | + // If file is in module/img directory under name object_pictovalue.png |
|
| 77 | + // use this->picto='pictovalue@module' |
|
| 78 | + $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
| 79 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
| 80 | + // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
| 81 | + // for specific path of parts (eg: /titre/core/modules/barcode) |
|
| 82 | + // for specific css file (eg: /titre/css/titre.css.php) |
|
| 83 | + $this->module_parts = array( |
|
| 84 | + // Set this to 1 if module has its own trigger directory |
|
| 85 | + 'triggers' => 1, |
|
| 86 | + // Set this to 1 if module has its own login method directory |
|
| 87 | + //'login' => 0, |
|
| 88 | + // Set this to 1 if module has its own substitution function file |
|
| 89 | + //'substitutions' => 0, |
|
| 90 | + // Set this to 1 if module has its own menus handler directory |
|
| 91 | + //'menus' => 0, |
|
| 92 | + // Set this to 1 if module has its own barcode directory |
|
| 93 | + //'barcode' => 0, |
|
| 94 | + // Set this to 1 if module has its own models directory |
|
| 95 | + 'models' => 1, |
|
| 96 | + // Set this to relative path of css if module has its own css file |
|
| 97 | + //'css' => '/titre/css/mycss.css.php', |
|
| 98 | + // Set here all hooks context managed by module |
|
| 99 | + 'hooks' => array( |
|
| 100 | + 'invoicecard' |
|
| 101 | + ,'invoicesuppliercard' |
|
| 102 | + ,'propalcard' |
|
| 103 | + ,'supplier_proposalcard' |
|
| 104 | + ,'ordercard' |
|
| 105 | + ,'ordersuppliercard' |
|
| 106 | + ,'odtgeneration' |
|
| 107 | + ,'orderstoinvoice' |
|
| 108 | + ,'admin' |
|
| 109 | + ,'invoicereccard' |
|
| 110 | + ,'consumptionthirdparty' |
|
| 111 | + ,'ordershipmentcard' |
|
| 112 | + ,'expeditioncard' |
|
| 113 | 113 | ,'deliverycard' |
| 114 | - ) |
|
| 115 | - // Set here all workflow context managed by module |
|
| 116 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 117 | - ); |
|
| 114 | + ) |
|
| 115 | + // Set here all workflow context managed by module |
|
| 116 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 117 | + ); |
|
| 118 | 118 | |
| 119 | - // Data directories to create when module is enabled. |
|
| 120 | - // Example: this->dirs = array("/titre/temp"); |
|
| 121 | - $this->dirs = array(); |
|
| 119 | + // Data directories to create when module is enabled. |
|
| 120 | + // Example: this->dirs = array("/titre/temp"); |
|
| 121 | + $this->dirs = array(); |
|
| 122 | 122 | |
| 123 | - // Config pages. Put here list of php pages |
|
| 124 | - // stored into titre/admin directory, used to setup module. |
|
| 125 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 123 | + // Config pages. Put here list of php pages |
|
| 124 | + // stored into titre/admin directory, used to setup module. |
|
| 125 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 126 | 126 | |
| 127 | - // Dependencies |
|
| 128 | - // List of modules id that must be enabled if this module is enabled |
|
| 129 | - $this->depends = array(); |
|
| 127 | + // Dependencies |
|
| 128 | + // List of modules id that must be enabled if this module is enabled |
|
| 129 | + $this->depends = array(); |
|
| 130 | 130 | |
| 131 | 131 | $this->conflictwith=array('modMilestone'); |
| 132 | - // List of modules id to disable if this one is disabled |
|
| 133 | - $this->requiredby = array(); |
|
| 134 | - // Minimum version of PHP required by module |
|
| 135 | - $this->phpmin = array(5, 3); |
|
| 136 | - // Minimum version of Dolibarr required by module |
|
| 137 | - $this->need_dolibarr_version = array(3, 2); |
|
| 138 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 139 | - // Constants |
|
| 140 | - // List of particular constants to add when module is enabled |
|
| 141 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 142 | - // Example: |
|
| 143 | - $this->const = array( |
|
| 144 | - 0=>array( |
|
| 145 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 146 | - 'chaine', |
|
| 147 | - 'I', |
|
| 148 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 149 | - 1 |
|
| 150 | - ) |
|
| 132 | + // List of modules id to disable if this one is disabled |
|
| 133 | + $this->requiredby = array(); |
|
| 134 | + // Minimum version of PHP required by module |
|
| 135 | + $this->phpmin = array(5, 3); |
|
| 136 | + // Minimum version of Dolibarr required by module |
|
| 137 | + $this->need_dolibarr_version = array(3, 2); |
|
| 138 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 139 | + // Constants |
|
| 140 | + // List of particular constants to add when module is enabled |
|
| 141 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 142 | + // Example: |
|
| 143 | + $this->const = array( |
|
| 144 | + 0=>array( |
|
| 145 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 146 | + 'chaine', |
|
| 147 | + 'I', |
|
| 148 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 149 | + 1 |
|
| 150 | + ) |
|
| 151 | 151 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
| 152 | 152 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
| 153 | 153 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
| 154 | 154 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
| 155 | 155 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
| 156 | - // 1=>array( |
|
| 157 | - // 'MYMODULE_MYNEWCONST2', |
|
| 158 | - // 'chaine', |
|
| 159 | - // 'myvalue', |
|
| 160 | - // 'This is another constant to add', |
|
| 161 | - // 0 |
|
| 162 | - // ) |
|
| 163 | - ); |
|
| 156 | + // 1=>array( |
|
| 157 | + // 'MYMODULE_MYNEWCONST2', |
|
| 158 | + // 'chaine', |
|
| 159 | + // 'myvalue', |
|
| 160 | + // 'This is another constant to add', |
|
| 161 | + // 0 |
|
| 162 | + // ) |
|
| 163 | + ); |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | |
| 168 | - // Array to add new pages in new tabs |
|
| 169 | - // Example: |
|
| 170 | - $this->tabs = array( |
|
| 171 | - // // To add a new tab identified by code tabname1 |
|
| 172 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 173 | - // // To add another new tab identified by code tabname2 |
|
| 174 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 175 | - // // To remove an existing tab identified by code tabname |
|
| 176 | - // 'objecttype:-tabname' |
|
| 177 | - ); |
|
| 178 | - // where objecttype can be |
|
| 179 | - // 'thirdparty' to add a tab in third party view |
|
| 180 | - // 'intervention' to add a tab in intervention view |
|
| 181 | - // 'order_supplier' to add a tab in supplier order view |
|
| 182 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 183 | - // 'invoice' to add a tab in customer invoice view |
|
| 184 | - // 'order' to add a tab in customer order view |
|
| 185 | - // 'product' to add a tab in product view |
|
| 186 | - // 'stock' to add a tab in stock view |
|
| 187 | - // 'propal' to add a tab in propal view |
|
| 188 | - // 'member' to add a tab in fundation member view |
|
| 189 | - // 'contract' to add a tab in contract view |
|
| 190 | - // 'user' to add a tab in user view |
|
| 191 | - // 'group' to add a tab in group view |
|
| 192 | - // 'contact' to add a tab in contact view |
|
| 193 | - // 'categories_x' to add a tab in category view |
|
| 194 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 195 | - // Dictionnaries |
|
| 196 | - if (! isset($conf->subtotal->enabled)) { |
|
| 197 | - $conf->subtotal=new stdClass(); |
|
| 198 | - $conf->subtotal->enabled = 0; |
|
| 199 | - } |
|
| 200 | - $this->dictionaries = array( |
|
| 168 | + // Array to add new pages in new tabs |
|
| 169 | + // Example: |
|
| 170 | + $this->tabs = array( |
|
| 171 | + // // To add a new tab identified by code tabname1 |
|
| 172 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 173 | + // // To add another new tab identified by code tabname2 |
|
| 174 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 175 | + // // To remove an existing tab identified by code tabname |
|
| 176 | + // 'objecttype:-tabname' |
|
| 177 | + ); |
|
| 178 | + // where objecttype can be |
|
| 179 | + // 'thirdparty' to add a tab in third party view |
|
| 180 | + // 'intervention' to add a tab in intervention view |
|
| 181 | + // 'order_supplier' to add a tab in supplier order view |
|
| 182 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 183 | + // 'invoice' to add a tab in customer invoice view |
|
| 184 | + // 'order' to add a tab in customer order view |
|
| 185 | + // 'product' to add a tab in product view |
|
| 186 | + // 'stock' to add a tab in stock view |
|
| 187 | + // 'propal' to add a tab in propal view |
|
| 188 | + // 'member' to add a tab in fundation member view |
|
| 189 | + // 'contract' to add a tab in contract view |
|
| 190 | + // 'user' to add a tab in user view |
|
| 191 | + // 'group' to add a tab in group view |
|
| 192 | + // 'contact' to add a tab in contact view |
|
| 193 | + // 'categories_x' to add a tab in category view |
|
| 194 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 195 | + // Dictionnaries |
|
| 196 | + if (! isset($conf->subtotal->enabled)) { |
|
| 197 | + $conf->subtotal=new stdClass(); |
|
| 198 | + $conf->subtotal->enabled = 0; |
|
| 199 | + } |
|
| 200 | + $this->dictionaries = array( |
|
| 201 | 201 | 'langs'=>'subtotal@subtotal', |
| 202 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 203 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 204 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 205 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 206 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 207 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 208 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 209 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 210 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
| 202 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 203 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 204 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 205 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 206 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 207 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 208 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 209 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 210 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
| 211 | 211 | ); |
| 212 | - /* Example: |
|
| 212 | + /* Example: |
|
| 213 | 213 | // This is to avoid warnings |
| 214 | 214 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
| 215 | 215 | $this->dictionnaries=array( |
@@ -250,223 +250,223 @@ discard block |
||
| 250 | 250 | ); |
| 251 | 251 | */ |
| 252 | 252 | |
| 253 | - // Boxes |
|
| 254 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 255 | - $this->boxes = array(); // Boxes list |
|
| 253 | + // Boxes |
|
| 254 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 255 | + $this->boxes = array(); // Boxes list |
|
| 256 | 256 | |
| 257 | - /* |
|
| 257 | + /* |
|
| 258 | 258 | $this->boxes[$r][1] = "myboxb.php"; |
| 259 | 259 | $r++; |
| 260 | 260 | */ |
| 261 | 261 | |
| 262 | - // Permissions |
|
| 263 | - $this->rights = array(); // Permission array used by this module |
|
| 264 | - $r = 0; |
|
| 262 | + // Permissions |
|
| 263 | + $this->rights = array(); // Permission array used by this module |
|
| 264 | + $r = 0; |
|
| 265 | 265 | |
| 266 | - // Add here list of permission defined by |
|
| 267 | - // an id, a label, a boolean and two constant strings. |
|
| 268 | - // Example: |
|
| 269 | - //// Permission id (must not be already used) |
|
| 270 | - //$this->rights[$r][0] = 2000; |
|
| 271 | - //// Permission label |
|
| 272 | - //$this->rights[$r][1] = 'Permision label'; |
|
| 273 | - //// Permission by default for new user (0/1) |
|
| 274 | - //$this->rights[$r][3] = 1; |
|
| 275 | - //// In php code, permission will be checked by test |
|
| 276 | - //// if ($user->rights->permkey->level1->level2) |
|
| 277 | - //$this->rights[$r][4] = 'level1'; |
|
| 278 | - //// In php code, permission will be checked by test |
|
| 279 | - //// if ($user->rights->permkey->level1->level2) |
|
| 280 | - //$this->rights[$r][5] = 'level2'; |
|
| 281 | - //$r++; |
|
| 282 | - // Main menu entries |
|
| 283 | - $this->menus = array(); // List of menus to add |
|
| 284 | - $r = 0; |
|
| 266 | + // Add here list of permission defined by |
|
| 267 | + // an id, a label, a boolean and two constant strings. |
|
| 268 | + // Example: |
|
| 269 | + //// Permission id (must not be already used) |
|
| 270 | + //$this->rights[$r][0] = 2000; |
|
| 271 | + //// Permission label |
|
| 272 | + //$this->rights[$r][1] = 'Permision label'; |
|
| 273 | + //// Permission by default for new user (0/1) |
|
| 274 | + //$this->rights[$r][3] = 1; |
|
| 275 | + //// In php code, permission will be checked by test |
|
| 276 | + //// if ($user->rights->permkey->level1->level2) |
|
| 277 | + //$this->rights[$r][4] = 'level1'; |
|
| 278 | + //// In php code, permission will be checked by test |
|
| 279 | + //// if ($user->rights->permkey->level1->level2) |
|
| 280 | + //$this->rights[$r][5] = 'level2'; |
|
| 281 | + //$r++; |
|
| 282 | + // Main menu entries |
|
| 283 | + $this->menus = array(); // List of menus to add |
|
| 284 | + $r = 0; |
|
| 285 | 285 | |
| 286 | - // Add here entries to declare new menus |
|
| 287 | - // |
|
| 288 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 289 | - //$this->menu[$r]=array( |
|
| 290 | - // // Put 0 if this is a top menu |
|
| 291 | - // 'fk_menu'=>0, |
|
| 292 | - // // This is a Top menu entry |
|
| 293 | - // 'type'=>'top', |
|
| 294 | - // 'titre'=>'titre top menu', |
|
| 295 | - // 'mainmenu'=>'titre', |
|
| 296 | - // 'leftmenu'=>'titre', |
|
| 297 | - // 'url'=>'/titre/pagetop.php', |
|
| 298 | - // // Lang file to use (without .lang) by module. |
|
| 299 | - // // File must be in langs/code_CODE/ directory. |
|
| 300 | - // 'langs'=>'mylangfile', |
|
| 301 | - // 'position'=>100, |
|
| 302 | - // // Define condition to show or hide menu entry. |
|
| 303 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 304 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 305 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 306 | - // // if you want your menu with a permission rules |
|
| 307 | - // 'perms'=>'1', |
|
| 308 | - // 'target'=>'', |
|
| 309 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 310 | - // 'user'=>2 |
|
| 311 | - //); |
|
| 312 | - //$r++; |
|
| 313 | - //$this->menu[$r]=array( |
|
| 314 | - // // Use r=value where r is index key used for the parent menu entry |
|
| 315 | - // // (higher parent must be a top menu entry) |
|
| 316 | - // 'fk_menu'=>'r=0', |
|
| 317 | - // // This is a Left menu entry |
|
| 318 | - // 'type'=>'left', |
|
| 319 | - // 'titre'=>'titre left menu', |
|
| 320 | - // 'mainmenu'=>'titre', |
|
| 321 | - // 'leftmenu'=>'titre', |
|
| 322 | - // 'url'=>'/titre/pagelevel1.php', |
|
| 323 | - // // Lang file to use (without .lang) by module. |
|
| 324 | - // // File must be in langs/code_CODE/ directory. |
|
| 325 | - // 'langs'=>'mylangfile', |
|
| 326 | - // 'position'=>100, |
|
| 327 | - // // Define condition to show or hide menu entry. |
|
| 328 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 329 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 330 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 331 | - // // if you want your menu with a permission rules |
|
| 332 | - // 'perms'=>'1', |
|
| 333 | - // 'target'=>'', |
|
| 334 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 335 | - // 'user'=>2 |
|
| 336 | - //); |
|
| 337 | - //$r++; |
|
| 338 | - // |
|
| 339 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 340 | - //$this->menu[$r]=array( |
|
| 341 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 342 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 343 | - // // This is a Left menu entry |
|
| 344 | - // 'type'=>'left', |
|
| 345 | - // 'titre'=>'titre left menu', |
|
| 346 | - // 'mainmenu'=>'mainmenucode', |
|
| 347 | - // 'leftmenu'=>'titre', |
|
| 348 | - // 'url'=>'/titre/pagelevel2.php', |
|
| 349 | - // // Lang file to use (without .lang) by module. |
|
| 350 | - // // File must be in langs/code_CODE/ directory. |
|
| 351 | - // 'langs'=>'mylangfile', |
|
| 352 | - // 'position'=>100, |
|
| 353 | - // // Define condition to show or hide menu entry. |
|
| 354 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 355 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 356 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 357 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 358 | - // // if you want your menu with a permission rules |
|
| 359 | - // 'perms'=>'1', |
|
| 360 | - // 'target'=>'', |
|
| 361 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 362 | - // 'user'=>2 |
|
| 363 | - //); |
|
| 364 | - //$r++; |
|
| 365 | - // Exports |
|
| 366 | - $r = 1; |
|
| 286 | + // Add here entries to declare new menus |
|
| 287 | + // |
|
| 288 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 289 | + //$this->menu[$r]=array( |
|
| 290 | + // // Put 0 if this is a top menu |
|
| 291 | + // 'fk_menu'=>0, |
|
| 292 | + // // This is a Top menu entry |
|
| 293 | + // 'type'=>'top', |
|
| 294 | + // 'titre'=>'titre top menu', |
|
| 295 | + // 'mainmenu'=>'titre', |
|
| 296 | + // 'leftmenu'=>'titre', |
|
| 297 | + // 'url'=>'/titre/pagetop.php', |
|
| 298 | + // // Lang file to use (without .lang) by module. |
|
| 299 | + // // File must be in langs/code_CODE/ directory. |
|
| 300 | + // 'langs'=>'mylangfile', |
|
| 301 | + // 'position'=>100, |
|
| 302 | + // // Define condition to show or hide menu entry. |
|
| 303 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 304 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 305 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 306 | + // // if you want your menu with a permission rules |
|
| 307 | + // 'perms'=>'1', |
|
| 308 | + // 'target'=>'', |
|
| 309 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 310 | + // 'user'=>2 |
|
| 311 | + //); |
|
| 312 | + //$r++; |
|
| 313 | + //$this->menu[$r]=array( |
|
| 314 | + // // Use r=value where r is index key used for the parent menu entry |
|
| 315 | + // // (higher parent must be a top menu entry) |
|
| 316 | + // 'fk_menu'=>'r=0', |
|
| 317 | + // // This is a Left menu entry |
|
| 318 | + // 'type'=>'left', |
|
| 319 | + // 'titre'=>'titre left menu', |
|
| 320 | + // 'mainmenu'=>'titre', |
|
| 321 | + // 'leftmenu'=>'titre', |
|
| 322 | + // 'url'=>'/titre/pagelevel1.php', |
|
| 323 | + // // Lang file to use (without .lang) by module. |
|
| 324 | + // // File must be in langs/code_CODE/ directory. |
|
| 325 | + // 'langs'=>'mylangfile', |
|
| 326 | + // 'position'=>100, |
|
| 327 | + // // Define condition to show or hide menu entry. |
|
| 328 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 329 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 330 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 331 | + // // if you want your menu with a permission rules |
|
| 332 | + // 'perms'=>'1', |
|
| 333 | + // 'target'=>'', |
|
| 334 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 335 | + // 'user'=>2 |
|
| 336 | + //); |
|
| 337 | + //$r++; |
|
| 338 | + // |
|
| 339 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 340 | + //$this->menu[$r]=array( |
|
| 341 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 342 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 343 | + // // This is a Left menu entry |
|
| 344 | + // 'type'=>'left', |
|
| 345 | + // 'titre'=>'titre left menu', |
|
| 346 | + // 'mainmenu'=>'mainmenucode', |
|
| 347 | + // 'leftmenu'=>'titre', |
|
| 348 | + // 'url'=>'/titre/pagelevel2.php', |
|
| 349 | + // // Lang file to use (without .lang) by module. |
|
| 350 | + // // File must be in langs/code_CODE/ directory. |
|
| 351 | + // 'langs'=>'mylangfile', |
|
| 352 | + // 'position'=>100, |
|
| 353 | + // // Define condition to show or hide menu entry. |
|
| 354 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 355 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 356 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 357 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 358 | + // // if you want your menu with a permission rules |
|
| 359 | + // 'perms'=>'1', |
|
| 360 | + // 'target'=>'', |
|
| 361 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 362 | + // 'user'=>2 |
|
| 363 | + //); |
|
| 364 | + //$r++; |
|
| 365 | + // Exports |
|
| 366 | + $r = 1; |
|
| 367 | 367 | |
| 368 | - // Example: |
|
| 369 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 370 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 371 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 372 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
| 373 | - //// Set to 1 to always show when module is enabled. |
|
| 374 | - //$this->export_enabled[$r]='1'; |
|
| 375 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 376 | - //$this->export_fields_array[$r]=array( |
|
| 377 | - // 's.rowid'=>"IdCompany", |
|
| 378 | - // 's.nom'=>'CompanyName', |
|
| 379 | - // 's.address'=>'Address', |
|
| 380 | - // 's.cp'=>'Zip', |
|
| 381 | - // 's.ville'=>'Town', |
|
| 382 | - // 's.fk_pays'=>'Country', |
|
| 383 | - // 's.tel'=>'Phone', |
|
| 384 | - // 's.siren'=>'ProfId1', |
|
| 385 | - // 's.siret'=>'ProfId2', |
|
| 386 | - // 's.ape'=>'ProfId3', |
|
| 387 | - // 's.idprof4'=>'ProfId4', |
|
| 388 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 389 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 390 | - // 'f.rowid'=>"InvoiceId", |
|
| 391 | - // 'f.facnumber'=>"InvoiceRef", |
|
| 392 | - // 'f.datec'=>"InvoiceDateCreation", |
|
| 393 | - // 'f.datef'=>"DateInvoice", |
|
| 394 | - // 'f.total'=>"TotalHT", |
|
| 395 | - // 'f.total_ttc'=>"TotalTTC", |
|
| 396 | - // 'f.tva'=>"TotalVAT", |
|
| 397 | - // 'f.paye'=>"InvoicePaid", |
|
| 398 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
| 399 | - // 'f.note'=>"InvoiceNote", |
|
| 400 | - // 'fd.rowid'=>'LineId', |
|
| 401 | - // 'fd.description'=>"LineDescription", |
|
| 402 | - // 'fd.price'=>"LineUnitPrice", |
|
| 403 | - // 'fd.tva_tx'=>"LineVATRate", |
|
| 404 | - // 'fd.qty'=>"LineQty", |
|
| 405 | - // 'fd.total_ht'=>"LineTotalHT", |
|
| 406 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
| 407 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 408 | - // 'fd.date_start'=>"DateStart", |
|
| 409 | - // 'fd.date_end'=>"DateEnd", |
|
| 410 | - // 'fd.fk_product'=>'ProductId', |
|
| 411 | - // 'p.ref'=>'ProductRef' |
|
| 412 | - //); |
|
| 413 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 414 | - // 's.nom'=>'company', |
|
| 415 | - // 's.address'=>'company', |
|
| 416 | - // 's.cp'=>'company', |
|
| 417 | - // 's.ville'=>'company', |
|
| 418 | - // 's.fk_pays'=>'company', |
|
| 419 | - // 's.tel'=>'company', |
|
| 420 | - // 's.siren'=>'company', |
|
| 421 | - // 's.siret'=>'company', |
|
| 422 | - // 's.ape'=>'company', |
|
| 423 | - // 's.idprof4'=>'company', |
|
| 424 | - // 's.code_compta'=>'company', |
|
| 425 | - // 's.code_compta_fournisseur'=>'company', |
|
| 426 | - // 'f.rowid'=>"invoice", |
|
| 427 | - // 'f.facnumber'=>"invoice", |
|
| 428 | - // 'f.datec'=>"invoice", |
|
| 429 | - // 'f.datef'=>"invoice", |
|
| 430 | - // 'f.total'=>"invoice", |
|
| 431 | - // 'f.total_ttc'=>"invoice", |
|
| 432 | - // 'f.tva'=>"invoice", |
|
| 433 | - // 'f.paye'=>"invoice", |
|
| 434 | - // 'f.fk_statut'=>'invoice', |
|
| 435 | - // 'f.note'=>"invoice", |
|
| 436 | - // 'fd.rowid'=>'invoice_line', |
|
| 437 | - // 'fd.description'=>"invoice_line", |
|
| 438 | - // 'fd.price'=>"invoice_line", |
|
| 439 | - // 'fd.total_ht'=>"invoice_line", |
|
| 440 | - // 'fd.total_tva'=>"invoice_line", |
|
| 441 | - // 'fd.total_ttc'=>"invoice_line", |
|
| 442 | - // 'fd.tva_tx'=>"invoice_line", |
|
| 443 | - // 'fd.qty'=>"invoice_line", |
|
| 444 | - // 'fd.date_start'=>"invoice_line", |
|
| 445 | - // 'fd.date_end'=>"invoice_line", |
|
| 446 | - // 'fd.fk_product'=>'product', |
|
| 447 | - // 'p.ref'=>'product' |
|
| 448 | - //); |
|
| 449 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 450 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 451 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 452 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 453 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 454 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 455 | - // . 'AND f.rowid = fd.fk_facture'; |
|
| 456 | - //$r++; |
|
| 457 | - } |
|
| 368 | + // Example: |
|
| 369 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 370 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 371 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 372 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
| 373 | + //// Set to 1 to always show when module is enabled. |
|
| 374 | + //$this->export_enabled[$r]='1'; |
|
| 375 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 376 | + //$this->export_fields_array[$r]=array( |
|
| 377 | + // 's.rowid'=>"IdCompany", |
|
| 378 | + // 's.nom'=>'CompanyName', |
|
| 379 | + // 's.address'=>'Address', |
|
| 380 | + // 's.cp'=>'Zip', |
|
| 381 | + // 's.ville'=>'Town', |
|
| 382 | + // 's.fk_pays'=>'Country', |
|
| 383 | + // 's.tel'=>'Phone', |
|
| 384 | + // 's.siren'=>'ProfId1', |
|
| 385 | + // 's.siret'=>'ProfId2', |
|
| 386 | + // 's.ape'=>'ProfId3', |
|
| 387 | + // 's.idprof4'=>'ProfId4', |
|
| 388 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 389 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 390 | + // 'f.rowid'=>"InvoiceId", |
|
| 391 | + // 'f.facnumber'=>"InvoiceRef", |
|
| 392 | + // 'f.datec'=>"InvoiceDateCreation", |
|
| 393 | + // 'f.datef'=>"DateInvoice", |
|
| 394 | + // 'f.total'=>"TotalHT", |
|
| 395 | + // 'f.total_ttc'=>"TotalTTC", |
|
| 396 | + // 'f.tva'=>"TotalVAT", |
|
| 397 | + // 'f.paye'=>"InvoicePaid", |
|
| 398 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
| 399 | + // 'f.note'=>"InvoiceNote", |
|
| 400 | + // 'fd.rowid'=>'LineId', |
|
| 401 | + // 'fd.description'=>"LineDescription", |
|
| 402 | + // 'fd.price'=>"LineUnitPrice", |
|
| 403 | + // 'fd.tva_tx'=>"LineVATRate", |
|
| 404 | + // 'fd.qty'=>"LineQty", |
|
| 405 | + // 'fd.total_ht'=>"LineTotalHT", |
|
| 406 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
| 407 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 408 | + // 'fd.date_start'=>"DateStart", |
|
| 409 | + // 'fd.date_end'=>"DateEnd", |
|
| 410 | + // 'fd.fk_product'=>'ProductId', |
|
| 411 | + // 'p.ref'=>'ProductRef' |
|
| 412 | + //); |
|
| 413 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 414 | + // 's.nom'=>'company', |
|
| 415 | + // 's.address'=>'company', |
|
| 416 | + // 's.cp'=>'company', |
|
| 417 | + // 's.ville'=>'company', |
|
| 418 | + // 's.fk_pays'=>'company', |
|
| 419 | + // 's.tel'=>'company', |
|
| 420 | + // 's.siren'=>'company', |
|
| 421 | + // 's.siret'=>'company', |
|
| 422 | + // 's.ape'=>'company', |
|
| 423 | + // 's.idprof4'=>'company', |
|
| 424 | + // 's.code_compta'=>'company', |
|
| 425 | + // 's.code_compta_fournisseur'=>'company', |
|
| 426 | + // 'f.rowid'=>"invoice", |
|
| 427 | + // 'f.facnumber'=>"invoice", |
|
| 428 | + // 'f.datec'=>"invoice", |
|
| 429 | + // 'f.datef'=>"invoice", |
|
| 430 | + // 'f.total'=>"invoice", |
|
| 431 | + // 'f.total_ttc'=>"invoice", |
|
| 432 | + // 'f.tva'=>"invoice", |
|
| 433 | + // 'f.paye'=>"invoice", |
|
| 434 | + // 'f.fk_statut'=>'invoice', |
|
| 435 | + // 'f.note'=>"invoice", |
|
| 436 | + // 'fd.rowid'=>'invoice_line', |
|
| 437 | + // 'fd.description'=>"invoice_line", |
|
| 438 | + // 'fd.price'=>"invoice_line", |
|
| 439 | + // 'fd.total_ht'=>"invoice_line", |
|
| 440 | + // 'fd.total_tva'=>"invoice_line", |
|
| 441 | + // 'fd.total_ttc'=>"invoice_line", |
|
| 442 | + // 'fd.tva_tx'=>"invoice_line", |
|
| 443 | + // 'fd.qty'=>"invoice_line", |
|
| 444 | + // 'fd.date_start'=>"invoice_line", |
|
| 445 | + // 'fd.date_end'=>"invoice_line", |
|
| 446 | + // 'fd.fk_product'=>'product', |
|
| 447 | + // 'p.ref'=>'product' |
|
| 448 | + //); |
|
| 449 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 450 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 451 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 452 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 453 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 454 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 455 | + // . 'AND f.rowid = fd.fk_facture'; |
|
| 456 | + //$r++; |
|
| 457 | + } |
|
| 458 | 458 | |
| 459 | - /** |
|
| 460 | - * Function called when module is enabled. |
|
| 461 | - * The init function add constants, boxes, permissions and menus |
|
| 462 | - * (defined in constructor) into Dolibarr database. |
|
| 463 | - * It also creates data directories |
|
| 464 | - * |
|
| 465 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 466 | - * @return int 1 if OK, 0 if KO |
|
| 467 | - */ |
|
| 468 | - public function init($options = '') |
|
| 469 | - { |
|
| 459 | + /** |
|
| 460 | + * Function called when module is enabled. |
|
| 461 | + * The init function add constants, boxes, permissions and menus |
|
| 462 | + * (defined in constructor) into Dolibarr database. |
|
| 463 | + * It also creates data directories |
|
| 464 | + * |
|
| 465 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 466 | + * @return int 1 if OK, 0 if KO |
|
| 467 | + */ |
|
| 468 | + public function init($options = '') |
|
| 469 | + { |
|
| 470 | 470 | global $conf, $db; |
| 471 | 471 | |
| 472 | 472 | |
@@ -474,46 +474,46 @@ discard block |
||
| 474 | 474 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
| 475 | 475 | } |
| 476 | 476 | */ |
| 477 | - $sql = array(); |
|
| 477 | + $sql = array(); |
|
| 478 | 478 | |
| 479 | - $result = $this->loadTables(); |
|
| 480 | - dol_include_once('/core/class/extrafields.class.php'); |
|
| 479 | + $result = $this->loadTables(); |
|
| 480 | + dol_include_once('/core/class/extrafields.class.php'); |
|
| 481 | 481 | |
| 482 | - $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
| 483 | - $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
| 484 | - foreach($TElementType as $element_type) { |
|
| 485 | - $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 486 | - $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 487 | - } |
|
| 482 | + $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
| 483 | + $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
| 484 | + foreach($TElementType as $element_type) { |
|
| 485 | + $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 486 | + $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 487 | + } |
|
| 488 | 488 | |
| 489 | - return $this->_init($sql, $options); |
|
| 490 | - } |
|
| 489 | + return $this->_init($sql, $options); |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - /** |
|
| 493 | - * Function called when module is disabled. |
|
| 494 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 495 | - * Data directories are not deleted |
|
| 496 | - * |
|
| 497 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 498 | - * @return int 1 if OK, 0 if KO |
|
| 499 | - */ |
|
| 500 | - public function remove($options = '') |
|
| 501 | - { |
|
| 502 | - $sql = array(); |
|
| 492 | + /** |
|
| 493 | + * Function called when module is disabled. |
|
| 494 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 495 | + * Data directories are not deleted |
|
| 496 | + * |
|
| 497 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 498 | + * @return int 1 if OK, 0 if KO |
|
| 499 | + */ |
|
| 500 | + public function remove($options = '') |
|
| 501 | + { |
|
| 502 | + $sql = array(); |
|
| 503 | 503 | |
| 504 | - return $this->_remove($sql, $options); |
|
| 505 | - } |
|
| 504 | + return $this->_remove($sql, $options); |
|
| 505 | + } |
|
| 506 | 506 | |
| 507 | - /** |
|
| 508 | - * Create tables, keys and data required by module |
|
| 509 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 510 | - * and create data commands must be stored in directory /titre/sql/ |
|
| 511 | - * This function is called by this->init |
|
| 512 | - * |
|
| 513 | - * @return int <=0 if KO, >0 if OK |
|
| 514 | - */ |
|
| 515 | - private function loadTables() |
|
| 516 | - { |
|
| 517 | - return $this->_load_tables('/subtotal/sql/'); |
|
| 518 | - } |
|
| 507 | + /** |
|
| 508 | + * Create tables, keys and data required by module |
|
| 509 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 510 | + * and create data commands must be stored in directory /titre/sql/ |
|
| 511 | + * This function is called by this->init |
|
| 512 | + * |
|
| 513 | + * @return int <=0 if KO, >0 if OK |
|
| 514 | + */ |
|
| 515 | + private function loadTables() |
|
| 516 | + { |
|
| 517 | + return $this->_load_tables('/subtotal/sql/'); |
|
| 518 | + } |
|
| 519 | 519 | } |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | * @return void |
| 102 | 102 | */ |
| 103 | 103 | |
| 104 | - var $module_number = 104777; |
|
| 104 | + var $module_number = 104777; |
|
| 105 | 105 | |
| 106 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 107 | - { |
|
| 108 | - global $langs,$db,$user, $conf; |
|
| 106 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 107 | + { |
|
| 108 | + global $langs,$db,$user, $conf; |
|
| 109 | 109 | |
| 110 | 110 | $langs->load('subtotal@subtotal'); |
| 111 | 111 | |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | $createRight = $user->rights->facture->creer; |
| 121 | 121 | } elseif($object->element == 'order_supplier' ) |
| 122 | 122 | { |
| 123 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 123 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 124 | 124 | } elseif($object->element == 'invoice_supplier' ) |
| 125 | 125 | { |
| 126 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 126 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 127 | 127 | } |
| 128 | 128 | elseif($object->element == 'shipping') |
| 129 | 129 | { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
| 179 | 179 | |
| 180 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 180 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 181 | 181 | } |
| 182 | 182 | else if($action==='ask_deleteallline') { |
| 183 | 183 | $form=new Form($db); |
@@ -399,36 +399,36 @@ discard block |
||
| 399 | 399 | $TContext = explode(':',$parameters['context']); |
| 400 | 400 | if ( |
| 401 | 401 | in_array('invoicecard',$TContext) |
| 402 | - || in_array('invoicesuppliercard',$TContext) |
|
| 402 | + || in_array('invoicesuppliercard',$TContext) |
|
| 403 | 403 | || in_array('propalcard',$TContext) |
| 404 | 404 | || in_array('ordercard',$TContext) |
| 405 | - || in_array('ordersuppliercard',$TContext) |
|
| 405 | + || in_array('ordersuppliercard',$TContext) |
|
| 406 | 406 | || in_array('invoicereccard',$TContext) |
| 407 | 407 | ) |
| 408 | - { |
|
| 409 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 408 | + { |
|
| 409 | + $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | + $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 411 | 411 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
| 412 | 412 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
| 413 | 413 | |
| 414 | 414 | $var=false; |
| 415 | - $out.= '<tr '.$bc[$var].'> |
|
| 415 | + $out.= '<tr '.$bc[$var].'> |
|
| 416 | 416 | <td colspan="4" align="right"> |
| 417 | 417 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 418 | 418 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
| 419 | 419 | </td> |
| 420 | 420 | </tr>'; |
| 421 | 421 | |
| 422 | - $var=!$var; |
|
| 423 | - $out.= '<tr '.$bc[$var].'> |
|
| 422 | + $var=!$var; |
|
| 423 | + $out.= '<tr '.$bc[$var].'> |
|
| 424 | 424 | <td colspan="4" align="right"> |
| 425 | 425 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 426 | 426 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
| 427 | 427 | </td> |
| 428 | 428 | </tr>'; |
| 429 | 429 | |
| 430 | - $var=!$var; |
|
| 431 | - $out.= '<tr '.$bc[$var].'> |
|
| 430 | + $var=!$var; |
|
| 431 | + $out.= '<tr '.$bc[$var].'> |
|
| 432 | 432 | <td colspan="4" align="right"> |
| 433 | 433 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
| 434 | 434 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -440,9 +440,9 @@ discard block |
||
| 440 | 440 | if ( |
| 441 | 441 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
| 442 | 442 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
| 443 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 443 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 444 | 444 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
| 445 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 445 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 446 | 446 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
| 447 | 447 | ) |
| 448 | 448 | { |
@@ -461,19 +461,19 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
| 464 | - return 1; |
|
| 464 | + return 1; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 468 | - { |
|
| 467 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 468 | + { |
|
| 469 | 469 | |
| 470 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 471 | - { |
|
| 470 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 471 | + { |
|
| 472 | 472 | |
| 473 | - } |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | - return 0; |
|
| 476 | - } |
|
| 475 | + return 0; |
|
| 476 | + } |
|
| 477 | 477 | |
| 478 | 478 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 479 | 479 | global $conf; |
@@ -522,11 +522,11 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | if ( |
| 524 | 524 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 525 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 525 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 526 | 526 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 527 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 527 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 528 | 528 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 529 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 529 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 530 | 530 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
| 531 | 531 | ) { |
| 532 | 532 | |
@@ -605,20 +605,20 @@ discard block |
||
| 605 | 605 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 606 | 606 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 607 | 607 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 608 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 609 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 610 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 608 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 609 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 610 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 611 | 611 | ) |
| 612 | - { |
|
| 612 | + { |
|
| 613 | 613 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
| 614 | 614 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 615 | 615 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 616 | 616 | $sessname3 = 'subtotal_hideprices_facture'; |
| 617 | 617 | } |
| 618 | 618 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
| 619 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 620 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 621 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 619 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 620 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 621 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 622 | 622 | } |
| 623 | 623 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
| 624 | 624 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -626,9 +626,9 @@ discard block |
||
| 626 | 626 | $sessname3 = 'subtotal_hideprices_propal'; |
| 627 | 627 | } |
| 628 | 628 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
| 629 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 630 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 631 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 629 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 630 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 631 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 632 | 632 | } |
| 633 | 633 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
| 634 | 634 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -636,9 +636,9 @@ discard block |
||
| 636 | 636 | $sessname3 = 'subtotal_hideprices_commande'; |
| 637 | 637 | } |
| 638 | 638 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
| 639 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 640 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 641 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 639 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 640 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 641 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 642 | 642 | } |
| 643 | 643 | else { |
| 644 | 644 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -663,17 +663,17 @@ discard block |
||
| 663 | 663 | foreach($object->lines as &$line) { |
| 664 | 664 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 665 | 665 | |
| 666 | - if($line->qty>=90) { |
|
| 667 | - $line->modsubtotal_total = 1; |
|
| 668 | - } |
|
| 669 | - else{ |
|
| 670 | - $line->modsubtotal_title = 1; |
|
| 671 | - } |
|
| 666 | + if($line->qty>=90) { |
|
| 667 | + $line->modsubtotal_total = 1; |
|
| 668 | + } |
|
| 669 | + else{ |
|
| 670 | + $line->modsubtotal_title = 1; |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | 673 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
| 674 | 674 | } |
| 675 | - } |
|
| 676 | - } |
|
| 675 | + } |
|
| 676 | + } |
|
| 677 | 677 | |
| 678 | 678 | } |
| 679 | 679 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | */ |
| 691 | 691 | else if($object->element=='invoice_supplier') |
| 692 | 692 | { |
| 693 | - $object->deleteline($idLine); |
|
| 693 | + $object->deleteline($idLine); |
|
| 694 | 694 | } |
| 695 | 695 | /** |
| 696 | 696 | * @var $object Propal |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | */ |
| 714 | 714 | else if($object->element=='order_supplier') |
| 715 | 715 | { |
| 716 | - $object->deleteline($idLine); |
|
| 716 | + $object->deleteline($idLine); |
|
| 717 | 717 | } |
| 718 | 718 | /** |
| 719 | 719 | * @var $object Facturerec |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | |
| 789 | 789 | foreach($object->lines as $l) { |
| 790 | 790 | |
| 791 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 791 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 792 | 792 | if($lid == $lineid) { |
| 793 | 793 | |
| 794 | 794 | $found = true; |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | |
| 798 | 798 | if($found) { |
| 799 | 799 | |
| 800 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 800 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 801 | 801 | |
| 802 | 802 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
| 803 | 803 | break; // end of story |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | if(method_exists('Closure','bind')) { |
| 930 | 930 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 931 | 931 | $sweetsThief = function ($pdf) { |
| 932 | - return $pdf->bMargin ; |
|
| 932 | + return $pdf->bMargin ; |
|
| 933 | 933 | }; |
| 934 | 934 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 935 | 935 | |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 998 | 998 | $total_to_print = price($total); |
| 999 | 999 | |
| 1000 | - $line->total_ht = $total; |
|
| 1000 | + $line->total_ht = $total; |
|
| 1001 | 1001 | $line->total = $total; |
| 1002 | 1002 | $line->total_tva = $total_tva; |
| 1003 | 1003 | $line->total_ttc = $total_ttc; |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1157 | - global $conf, $hideprices, $hookmanager; |
|
| 1157 | + global $conf, $hideprices, $hookmanager; |
|
| 1158 | 1158 | |
| 1159 | 1159 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1160 | 1160 | else $i = (int)$parameters; |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | 1195 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
| 1196 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1196 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1325 | - global $conf,$hideprices,$hookmanager; |
|
| 1325 | + global $conf,$hideprices,$hookmanager; |
|
| 1326 | 1326 | |
| 1327 | 1327 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1328 | 1328 | else $i = (int)$parameters; |
@@ -1330,18 +1330,18 @@ discard block |
||
| 1330 | 1330 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1331 | 1331 | $this->resprints = ' '; |
| 1332 | 1332 | |
| 1333 | - $line = $object->lines[$i]; |
|
| 1333 | + $line = $object->lines[$i]; |
|
| 1334 | 1334 | |
| 1335 | - // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1336 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1337 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1335 | + // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1336 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1337 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1338 | 1338 | |
| 1339 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1341 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1342 | - $this->resprints = price($TTotal['total_subprice']); |
|
| 1343 | - } |
|
| 1344 | - } |
|
| 1339 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | + if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1341 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1342 | + $this->resprints = price($TTotal['total_subprice']); |
|
| 1343 | + } |
|
| 1344 | + } |
|
| 1345 | 1345 | |
| 1346 | 1346 | if((float)DOL_VERSION<=3.6) { |
| 1347 | 1347 | return ''; |
@@ -1357,58 +1357,58 @@ discard block |
||
| 1357 | 1357 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1358 | 1358 | ) |
| 1359 | 1359 | { |
| 1360 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1361 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1362 | - { |
|
| 1363 | - $this->resprints = ' '; |
|
| 1360 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1361 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1362 | + { |
|
| 1363 | + $this->resprints = ' '; |
|
| 1364 | 1364 | |
| 1365 | - // currentcontext à modifier celon l'appel |
|
| 1366 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1367 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1365 | + // currentcontext à modifier celon l'appel |
|
| 1366 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1367 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1368 | 1368 | |
| 1369 | - } |
|
| 1369 | + } |
|
| 1370 | 1370 | } |
| 1371 | 1371 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1372 | 1372 | else if (!empty($hideprices)) |
| 1373 | 1373 | { |
| 1374 | 1374 | |
| 1375 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1376 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1377 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1378 | - { |
|
| 1375 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1376 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1377 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1378 | + { |
|
| 1379 | 1379 | |
| 1380 | - $this->resprints = ' '; |
|
| 1380 | + $this->resprints = ' '; |
|
| 1381 | 1381 | |
| 1382 | - // currentcontext à modifier celon l'appel |
|
| 1383 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1384 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1385 | - } |
|
| 1382 | + // currentcontext à modifier celon l'appel |
|
| 1383 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1384 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1385 | + } |
|
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | return 0; |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
| 1392 | - global $conf,$hideprices,$hookmanager; |
|
| 1392 | + global $conf,$hideprices,$hookmanager; |
|
| 1393 | 1393 | |
| 1394 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | - else $i = (int) $parameters; |
|
| 1394 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | + else $i = (int) $parameters; |
|
| 1396 | 1396 | |
| 1397 | 1397 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1398 | 1398 | $this->resprints = ' '; |
| 1399 | 1399 | |
| 1400 | - $line = $object->lines[$i]; |
|
| 1400 | + $line = $object->lines[$i]; |
|
| 1401 | 1401 | |
| 1402 | - // Affichage de la remise |
|
| 1403 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1404 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1402 | + // Affichage de la remise |
|
| 1403 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1404 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1405 | 1405 | |
| 1406 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1408 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1409 | - $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1410 | - } |
|
| 1411 | - } |
|
| 1406 | + if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | + if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1408 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1409 | + $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1410 | + } |
|
| 1411 | + } |
|
| 1412 | 1412 | |
| 1413 | 1413 | if((float)DOL_VERSION<=3.6) { |
| 1414 | 1414 | return ''; |
@@ -1418,15 +1418,15 @@ discard block |
||
| 1418 | 1418 | } |
| 1419 | 1419 | } |
| 1420 | 1420 | elseif (!empty($hideprices) |
| 1421 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1422 | - ) |
|
| 1423 | - { |
|
| 1424 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1425 | - { |
|
| 1426 | - $this->resprints = ' '; |
|
| 1427 | - return 1; |
|
| 1428 | - } |
|
| 1429 | - } |
|
| 1421 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1422 | + ) |
|
| 1423 | + { |
|
| 1424 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1425 | + { |
|
| 1426 | + $this->resprints = ' '; |
|
| 1427 | + return 1; |
|
| 1428 | + } |
|
| 1429 | + } |
|
| 1430 | 1430 | |
| 1431 | 1431 | return 0; |
| 1432 | 1432 | } |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
| 1465 | - global $conf,$hideprices,$hookmanager; |
|
| 1465 | + global $conf,$hideprices,$hookmanager; |
|
| 1466 | 1466 | |
| 1467 | 1467 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1468 | 1468 | $this->resprints = ' '; |
@@ -1487,31 +1487,31 @@ discard block |
||
| 1487 | 1487 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1488 | 1488 | ) |
| 1489 | 1489 | { |
| 1490 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1491 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1492 | - { |
|
| 1493 | - $this->resprints = ' '; |
|
| 1490 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1491 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1492 | + { |
|
| 1493 | + $this->resprints = ' '; |
|
| 1494 | 1494 | |
| 1495 | - // currentcontext à modifier celon l'appel |
|
| 1496 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1497 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1498 | - } |
|
| 1495 | + // currentcontext à modifier celon l'appel |
|
| 1496 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1497 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1498 | + } |
|
| 1499 | 1499 | } |
| 1500 | 1500 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1501 | 1501 | else if (!empty($hideprices)) |
| 1502 | 1502 | { |
| 1503 | 1503 | |
| 1504 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1505 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1506 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1507 | - { |
|
| 1504 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1505 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1506 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1507 | + { |
|
| 1508 | 1508 | |
| 1509 | - $this->resprints = ' '; |
|
| 1509 | + $this->resprints = ' '; |
|
| 1510 | 1510 | |
| 1511 | - // currentcontext à modifier celon l'appel |
|
| 1512 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1513 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1514 | - } |
|
| 1511 | + // currentcontext à modifier celon l'appel |
|
| 1512 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1513 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1514 | + } |
|
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | return 0; |
@@ -1635,33 +1635,33 @@ discard block |
||
| 1635 | 1635 | |
| 1636 | 1636 | $this->add_numerotation($object); |
| 1637 | 1637 | |
| 1638 | - foreach($object->lines as $k => &$l) { |
|
| 1639 | - if(TSubtotal::isSubtotal($l)) { |
|
| 1640 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1641 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1644 | - } |
|
| 1645 | - } |
|
| 1638 | + foreach($object->lines as $k => &$l) { |
|
| 1639 | + if(TSubtotal::isSubtotal($l)) { |
|
| 1640 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1641 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | + if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1644 | + } |
|
| 1645 | + } |
|
| 1646 | 1646 | |
| 1647 | 1647 | |
| 1648 | - // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
|
| 1649 | - if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1648 | + // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
|
| 1649 | + if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1650 | 1650 | { |
| 1651 | 1651 | $l->qty = $l->qty_asked; |
| 1652 | 1652 | unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight); |
| 1653 | 1653 | } |
| 1654 | - } |
|
| 1654 | + } |
|
| 1655 | 1655 | |
| 1656 | 1656 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1657 | 1657 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1658 | 1658 | |
| 1659 | 1659 | if ($hideInnerLines) { // si c une ligne de titre |
| 1660 | - $fk_parent_line=0; |
|
| 1660 | + $fk_parent_line=0; |
|
| 1661 | 1661 | $TLines =array(); |
| 1662 | 1662 | |
| 1663 | 1663 | $original_count=count($object->lines); |
| 1664 | - $TTvas = array(); // tableau de tva |
|
| 1664 | + $TTvas = array(); // tableau de tva |
|
| 1665 | 1665 | |
| 1666 | 1666 | foreach($object->lines as $k=>&$line) |
| 1667 | 1667 | { |
@@ -1700,48 +1700,48 @@ discard block |
||
| 1700 | 1700 | |
| 1701 | 1701 | if ($hideInnerLines) |
| 1702 | 1702 | { |
| 1703 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1704 | - { |
|
| 1705 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1703 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1704 | + { |
|
| 1705 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1706 | 1706 | |
| 1707 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1708 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1709 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1710 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1711 | - } |
|
| 1712 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1713 | - { |
|
| 1714 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1715 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1716 | - $nbtva = count($TTvas); |
|
| 1717 | - if(!empty($nbtva)){ |
|
| 1718 | - foreach ($TTvas as $tx =>$val){ |
|
| 1719 | - $l = clone $line; |
|
| 1720 | - $l->product_type = 1; |
|
| 1721 | - $l->special_code = ''; |
|
| 1722 | - $l->qty = 1; |
|
| 1723 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1724 | - $l->tva_tx = $tx; |
|
| 1725 | - $l->total_ht = $val['total_ht']; |
|
| 1726 | - $l->total_tva = $val['total_tva']; |
|
| 1727 | - $l->total = $line->total_ht; |
|
| 1728 | - $l->total_ttc = $val['total_ttc']; |
|
| 1729 | - $TLines[] = $l; |
|
| 1730 | - array_shift($TTvas); |
|
| 1731 | - } |
|
| 1732 | - } |
|
| 1707 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1708 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1709 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1710 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1711 | + } |
|
| 1712 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1713 | + { |
|
| 1714 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1715 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1716 | + $nbtva = count($TTvas); |
|
| 1717 | + if(!empty($nbtva)){ |
|
| 1718 | + foreach ($TTvas as $tx =>$val){ |
|
| 1719 | + $l = clone $line; |
|
| 1720 | + $l->product_type = 1; |
|
| 1721 | + $l->special_code = ''; |
|
| 1722 | + $l->qty = 1; |
|
| 1723 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1724 | + $l->tva_tx = $tx; |
|
| 1725 | + $l->total_ht = $val['total_ht']; |
|
| 1726 | + $l->total_tva = $val['total_tva']; |
|
| 1727 | + $l->total = $line->total_ht; |
|
| 1728 | + $l->total_ttc = $val['total_ttc']; |
|
| 1729 | + $TLines[] = $l; |
|
| 1730 | + array_shift($TTvas); |
|
| 1731 | + } |
|
| 1732 | + } |
|
| 1733 | 1733 | |
| 1734 | - // ajoute la ligne de sous-total |
|
| 1735 | - $TLines[] = $line; |
|
| 1736 | - } |
|
| 1737 | - } else { |
|
| 1734 | + // ajoute la ligne de sous-total |
|
| 1735 | + $TLines[] = $line; |
|
| 1736 | + } |
|
| 1737 | + } else { |
|
| 1738 | 1738 | |
| 1739 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1740 | - { |
|
| 1741 | - // ajoute la ligne de sous-total |
|
| 1742 | - $TLines[] = $line; |
|
| 1743 | - } |
|
| 1744 | - } |
|
| 1739 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1740 | + { |
|
| 1741 | + // ajoute la ligne de sous-total |
|
| 1742 | + $TLines[] = $line; |
|
| 1743 | + } |
|
| 1744 | + } |
|
| 1745 | 1745 | |
| 1746 | 1746 | |
| 1747 | 1747 | } |
@@ -1766,20 +1766,20 @@ discard block |
||
| 1766 | 1766 | $nbtva = count($TTvas); |
| 1767 | 1767 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
| 1768 | 1768 | { |
| 1769 | - foreach ($TTvas as $tx =>$val){ |
|
| 1770 | - $l = clone $line; |
|
| 1771 | - $l->product_type = 1; |
|
| 1772 | - $l->special_code = ''; |
|
| 1773 | - $l->qty = 1; |
|
| 1774 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1775 | - $l->tva_tx = $tx; |
|
| 1776 | - $l->total_ht = $val['total_ht']; |
|
| 1777 | - $l->total_tva = $val['total_tva']; |
|
| 1778 | - $l->total = $line->total_ht; |
|
| 1779 | - $l->total_ttc = $val['total_ttc']; |
|
| 1780 | - $TLines[] = $l; |
|
| 1781 | - array_shift($TTvas); |
|
| 1782 | - } |
|
| 1769 | + foreach ($TTvas as $tx =>$val){ |
|
| 1770 | + $l = clone $line; |
|
| 1771 | + $l->product_type = 1; |
|
| 1772 | + $l->special_code = ''; |
|
| 1773 | + $l->qty = 1; |
|
| 1774 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1775 | + $l->tva_tx = $tx; |
|
| 1776 | + $l->total_ht = $val['total_ht']; |
|
| 1777 | + $l->total_tva = $val['total_tva']; |
|
| 1778 | + $l->total = $line->total_ht; |
|
| 1779 | + $l->total_ttc = $val['total_ttc']; |
|
| 1780 | + $TLines[] = $l; |
|
| 1781 | + array_shift($TTvas); |
|
| 1782 | + } |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | global $nblignes; |
@@ -1791,7 +1791,7 @@ discard block |
||
| 1791 | 1791 | $this->resprints = ''; |
| 1792 | 1792 | return 0; |
| 1793 | 1793 | } |
| 1794 | - } |
|
| 1794 | + } |
|
| 1795 | 1795 | |
| 1796 | 1796 | return 0; |
| 1797 | 1797 | } |
@@ -1983,11 +1983,11 @@ discard block |
||
| 1983 | 1983 | } |
| 1984 | 1984 | elseif($object->element == 'order_supplier' ) |
| 1985 | 1985 | { |
| 1986 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1986 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1987 | 1987 | } |
| 1988 | 1988 | elseif($object->element == 'invoice_supplier' ) |
| 1989 | 1989 | { |
| 1990 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1990 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1991 | 1991 | } |
| 1992 | 1992 | elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
| 1993 | 1993 | { |
@@ -2020,7 +2020,7 @@ discard block |
||
| 2020 | 2020 | null; |
| 2021 | 2021 | } |
| 2022 | 2022 | else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
| 2023 | - { |
|
| 2023 | + { |
|
| 2024 | 2024 | if($object->element=='facture')$idvar = 'facid'; |
| 2025 | 2025 | else $idvar='id'; |
| 2026 | 2026 | |
@@ -2069,7 +2069,7 @@ discard block |
||
| 2069 | 2069 | //var_dump($line); |
| 2070 | 2070 | |
| 2071 | 2071 | // HTML 5 data for js |
| 2072 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2072 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2073 | 2073 | |
| 2074 | 2074 | |
| 2075 | 2075 | ?> |
@@ -2131,8 +2131,8 @@ discard block |
||
| 2131 | 2131 | } |
| 2132 | 2132 | |
| 2133 | 2133 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
| 2134 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2135 | - $line->description = ''; |
|
| 2134 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2135 | + $line->description = ''; |
|
| 2136 | 2136 | } |
| 2137 | 2137 | $newlabel = $line->label; |
| 2138 | 2138 | if($line->label=='' && !$isFreeText) { |
@@ -2166,38 +2166,38 @@ discard block |
||
| 2166 | 2166 | |
| 2167 | 2167 | |
| 2168 | 2168 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
| 2169 | - echo '<div>'; |
|
| 2170 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2171 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2172 | - echo '</div>'; |
|
| 2173 | - |
|
| 2174 | - if (TSubtotal::isTitle($line)) |
|
| 2175 | - { |
|
| 2176 | - $form = new Form($db); |
|
| 2177 | - echo '<div>'; |
|
| 2178 | - echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2179 | - echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2180 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2181 | - echo '</select>'; |
|
| 2182 | - echo '</div>'; |
|
| 2183 | - |
|
| 2184 | - if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2185 | - { |
|
| 2186 | - echo '<div>'; |
|
| 2187 | - echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2188 | - echo '</div>'; |
|
| 2189 | - } |
|
| 2190 | - echo '<div>'; |
|
| 2191 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2192 | - echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2193 | - echo '</div>'; |
|
| 2194 | - |
|
| 2195 | - echo '<div>'; |
|
| 2196 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2197 | - echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2198 | - echo '</div>'; |
|
| 2199 | - } |
|
| 2200 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2169 | + echo '<div>'; |
|
| 2170 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2171 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2172 | + echo '</div>'; |
|
| 2173 | + |
|
| 2174 | + if (TSubtotal::isTitle($line)) |
|
| 2175 | + { |
|
| 2176 | + $form = new Form($db); |
|
| 2177 | + echo '<div>'; |
|
| 2178 | + echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2179 | + echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2180 | + if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2181 | + echo '</select>'; |
|
| 2182 | + echo '</div>'; |
|
| 2183 | + |
|
| 2184 | + if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2185 | + { |
|
| 2186 | + echo '<div>'; |
|
| 2187 | + echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2188 | + echo '</div>'; |
|
| 2189 | + } |
|
| 2190 | + echo '<div>'; |
|
| 2191 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2192 | + echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2193 | + echo '</div>'; |
|
| 2194 | + |
|
| 2195 | + echo '<div>'; |
|
| 2196 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2197 | + echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2198 | + echo '</div>'; |
|
| 2199 | + } |
|
| 2200 | + else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2201 | 2201 | echo '</div>'; |
| 2202 | 2202 | |
| 2203 | 2203 | if($line->qty<10) { |
@@ -2714,17 +2714,17 @@ discard block |
||
| 2714 | 2714 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2715 | 2715 | { |
| 2716 | 2716 | |
| 2717 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2718 | - { |
|
| 2719 | - foreach ($object->lines as $line) |
|
| 2720 | - { |
|
| 2721 | - // fetch optionals attributes and labels |
|
| 2722 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2723 | - $extrafields=new ExtraFields($this->db); |
|
| 2724 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2725 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2726 | - } |
|
| 2727 | - } |
|
| 2717 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2718 | + { |
|
| 2719 | + foreach ($object->lines as $line) |
|
| 2720 | + { |
|
| 2721 | + // fetch optionals attributes and labels |
|
| 2722 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2723 | + $extrafields=new ExtraFields($this->db); |
|
| 2724 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2725 | + $line->fetch_optionals($line->id,$extralabels); |
|
| 2726 | + } |
|
| 2727 | + } |
|
| 2728 | 2728 | |
| 2729 | 2729 | $TSubNc = array(); |
| 2730 | 2730 | foreach ($object->lines as &$l) |
@@ -2815,80 +2815,80 @@ discard block |
||
| 2815 | 2815 | { |
| 2816 | 2816 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 2817 | 2817 | |
| 2818 | - $line = &$parameters['line']; |
|
| 2818 | + $line = &$parameters['line']; |
|
| 2819 | 2819 | |
| 2820 | - $ThtmlData['data-id'] = $line->id; |
|
| 2821 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2822 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2823 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2820 | + $ThtmlData['data-id'] = $line->id; |
|
| 2821 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2822 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2823 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2824 | 2824 | |
| 2825 | - if(TSubtotal::isTitle($line)){ |
|
| 2826 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2827 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2828 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2829 | - } |
|
| 2830 | - else{ |
|
| 2831 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2832 | - } |
|
| 2825 | + if(TSubtotal::isTitle($line)){ |
|
| 2826 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2827 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2828 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2829 | + } |
|
| 2830 | + else{ |
|
| 2831 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2832 | + } |
|
| 2833 | 2833 | |
| 2834 | 2834 | |
| 2835 | - // Change or add data from hooks |
|
| 2836 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2835 | + // Change or add data from hooks |
|
| 2836 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2837 | 2837 | |
| 2838 | - // hook |
|
| 2839 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2840 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2841 | - if ($reshook>0) |
|
| 2842 | - { |
|
| 2843 | - $ThtmlData = $hookmanager->resArray; |
|
| 2844 | - } |
|
| 2845 | - |
|
| 2846 | - return $this->implodeHtmlData($ThtmlData); |
|
| 2838 | + // hook |
|
| 2839 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2840 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2841 | + if ($reshook>0) |
|
| 2842 | + { |
|
| 2843 | + $ThtmlData = $hookmanager->resArray; |
|
| 2844 | + } |
|
| 2845 | + |
|
| 2846 | + return $this->implodeHtmlData($ThtmlData); |
|
| 2847 | 2847 | |
| 2848 | 2848 | } |
| 2849 | 2849 | |
| 2850 | 2850 | |
| 2851 | 2851 | function implodeHtmlData($ThtmlData = array()) |
| 2852 | 2852 | { |
| 2853 | - $data = ''; |
|
| 2854 | - foreach($ThtmlData as $k => $h ) |
|
| 2855 | - { |
|
| 2856 | - if(is_array($h)) |
|
| 2857 | - { |
|
| 2858 | - $h = json_encode($h); |
|
| 2859 | - } |
|
| 2853 | + $data = ''; |
|
| 2854 | + foreach($ThtmlData as $k => $h ) |
|
| 2855 | + { |
|
| 2856 | + if(is_array($h)) |
|
| 2857 | + { |
|
| 2858 | + $h = json_encode($h); |
|
| 2859 | + } |
|
| 2860 | 2860 | |
| 2861 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2862 | - } |
|
| 2861 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2862 | + } |
|
| 2863 | 2863 | |
| 2864 | - return $data; |
|
| 2864 | + return $data; |
|
| 2865 | 2865 | } |
| 2866 | 2866 | |
| 2867 | 2867 | function _ajax_block_order_js($object) |
| 2868 | 2868 | { |
| 2869 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2869 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2870 | 2870 | |
| 2871 | - /* |
|
| 2871 | + /* |
|
| 2872 | 2872 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2873 | 2873 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2874 | 2874 | */ |
| 2875 | 2875 | |
| 2876 | - $id=$object->id; |
|
| 2877 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2878 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2876 | + $id=$object->id; |
|
| 2877 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2878 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2879 | 2879 | |
| 2880 | - $id=$object->id; |
|
| 2881 | - $fk_element=$object->fk_element; |
|
| 2882 | - $table_element_line=$object->table_element_line; |
|
| 2883 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2884 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2885 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2880 | + $id=$object->id; |
|
| 2881 | + $fk_element=$object->fk_element; |
|
| 2882 | + $table_element_line=$object->table_element_line; |
|
| 2883 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2884 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2885 | + $filepath=(empty($filepath)?'':$filepath); |
|
| 2886 | 2886 | |
| 2887 | 2887 | |
| 2888 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2889 | - { |
|
| 2888 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2889 | + { |
|
| 2890 | 2890 | |
| 2891 | - ?> |
|
| 2891 | + ?> |
|
| 2892 | 2892 | |
| 2893 | 2893 | |
| 2894 | 2894 | <script type="text/javascript"> |