├── .gitignore
├── img
├── ATM_logo.jpg
├── dolifleet.png
├── object_dolifleet.png
├── Dolibarr_Preferred_Partner_logo.png
└── icon.svg
├── sql
└── llx_dolifleet_vehicule_rental_matrix.key.sql
├── README
├── config.php
├── langs
├── en_US
│ └── dolifleet.lang
└── fr_FR
│ └── dolifleet.lang
├── class
├── dictionaryContractType.class.php
├── dictionaryVehiculeMark.class.php
├── dictionaryVehiculeType.class.php
├── dictionaryVehiculeActivityType.class.php
├── vehiculeRental.class.php
├── vehiculeLink.class.php
├── vehiculeRentalMatrix.class.php
├── vehiculeActivity.class.php
├── dictionary.class.php
├── actions_dolifleet.class.php
├── vehiculeOperation.class.php
└── dolifleet.class.php
├── config.default.php
├── admin
├── vehicule_extrafields.php
├── dolifleet_about.php
├── multicompany_sharing.php
├── rental_matrix.php
└── dolifleet_setup.php
├── tpl
└── linkedobjectblock.tpl.php
├── core
├── boxes
│ └── dolifleet_box.php
└── modules
│ └── dolifleet
│ └── modules_rentalproposal.php
├── script
└── create-maj-base.php
├── rental_proposal_list.php
├── vehicule_list.php
├── matrix_tab.php
├── vehicule_card.php
├── rental_proposal_card.php
└── lib
└── dolifleet.lib.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .buildpath
2 | .project
3 | .settings/
4 | *.log
5 | /nbproject/private/
--------------------------------------------------------------------------------
/img/ATM_logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ATM-Consulting/dolibarr_module_dolifleet/master/img/ATM_logo.jpg
--------------------------------------------------------------------------------
/img/dolifleet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ATM-Consulting/dolibarr_module_dolifleet/master/img/dolifleet.png
--------------------------------------------------------------------------------
/img/object_dolifleet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ATM-Consulting/dolibarr_module_dolifleet/master/img/object_dolifleet.png
--------------------------------------------------------------------------------
/img/Dolibarr_Preferred_Partner_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ATM-Consulting/dolibarr_module_dolifleet/master/img/Dolibarr_Preferred_Partner_logo.png
--------------------------------------------------------------------------------
/sql/llx_dolifleet_vehicule_rental_matrix.key.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE llx_dolifleet_vehicule_rental_matrix ADD UNIQUE matrix_unicity (fk_soc, fk_c_type_vh, fk_c_mark_vh, delay);
2 |
--------------------------------------------------------------------------------
/img/icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2020 ATM Consulting
2 | *
3 | * This program and files/directory inner it is free software: you can
4 | * redistribute it and/or modify it under the terms of the
5 | * GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | require __DIR__.'/config.default.php';
19 |
20 |
--------------------------------------------------------------------------------
/langs/en_US/dolifleet.lang:
--------------------------------------------------------------------------------
1 | Module104087Name = doliFleet
2 | Module104087Desc = doliFleet Description
3 |
4 | ATMAbout = This module has been developed by ATM Consulting You can find the documentation on our wiki
Find our other modules on Dolistore
5 |
6 | doliFleetSetup = doliFleet module setup
7 | doliFleetAbout = About doliFleet
8 |
--------------------------------------------------------------------------------
/class/dictionaryContractType.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | dol_include_once('/dolifleet/class/dictionary.class.php');
28 |
29 | class dictionaryContractType extends dictionary
30 | {
31 | /** @var string $table_element Table name in SQL */
32 | public $table_element = 'c_dolifleet_contract_type';
33 |
34 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
35 | public $element = 'dolifleetContractType';
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/class/dictionaryVehiculeMark.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | dol_include_once('/dolifleet/class/dictionary.class.php');
28 |
29 | class dictionaryVehiculeMark extends dictionary
30 | {
31 | /** @var string $table_element Table name in SQL */
32 | public $table_element = 'c_dolifleet_vehicule_mark';
33 |
34 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
35 | public $element = 'dolifleetVehiculeMark';
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/class/dictionaryVehiculeType.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | dol_include_once('/dolifleet/class/dictionary.class.php');
28 |
29 | class dictionaryVehiculeType extends dictionary
30 | {
31 | /** @var string $table_element Table name in SQL */
32 | public $table_element = 'c_dolifleet_vehicule_type';
33 |
34 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
35 | public $element = 'dolifleetVehiculeType';
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/config.default.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if(is_file('../main.inc.php'))$dir = '../';
19 | else if(is_file('../../../main.inc.php'))$dir = '../../../';
20 | else $dir = '../../';
21 |
22 |
23 | if(!defined('INC_FROM_DOLIBARR') && defined('INC_FROM_CRON_SCRIPT')) {
24 | include($dir."master.inc.php");
25 | }
26 | elseif(!defined('INC_FROM_DOLIBARR')) {
27 | include($dir."main.inc.php");
28 | } else {
29 | global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
30 | }
31 |
32 | if(!defined('DB_HOST')) {
33 | define('DB_HOST',$dolibarr_main_db_host);
34 | define('DB_NAME',$dolibarr_main_db_name);
35 | define('DB_USER',$dolibarr_main_db_user);
36 | define('DB_PASS',$dolibarr_main_db_pass);
37 | define('DB_DRIVER',$dolibarr_main_db_type);
38 | }
39 |
40 | if(!dol_include_once('/abricot/inc.core.php')) {
41 | print $langs->trans('AbricotNotFound'). ' : Abricot';
42 | exit;
43 | }
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/class/dictionaryVehiculeActivityType.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | dol_include_once('/dolifleet/class/dictionary.class.php');
28 |
29 | class dictionaryVehiculeActivityType extends dictionary
30 | {
31 | /** @var string $table_element Table name in SQL */
32 | public $table_element = 'c_dolifleet_vehicule_activity_type';
33 |
34 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
35 | public $element = 'dolifleetVehiculeActivityType';
36 |
37 | public function getValueFromId($id, $field = 'label')
38 | {
39 | global $langs;
40 |
41 | if (empty($id)) return $langs->trans('NodoliFleetActivity');
42 |
43 | return parent::getValueFromId($id, $field); // TODO: Change the autogenerated stub
44 | }
45 |
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/admin/vehicule_extrafields.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | /**
19 | * \file admin/dolifleet_extrafields.php
20 | * \ingroup dolifleet
21 | * \brief Page to setup extra fields of dolifleet
22 | */
23 |
24 | $res = @include '../../main.inc.php'; // From htdocs directory
25 | if (! $res) {
26 | $res = @include '../../../main.inc.php'; // From "custom" directory
27 | }
28 |
29 |
30 | /*
31 | * Config of extrafield page for doliFleet
32 | */
33 | require_once '../lib/dolifleet.lib.php';
34 | require_once '../class/vehicule.class.php';
35 | $langs->loadLangs(array('dolifleet@dolifleet', 'admin', 'other'));
36 |
37 | $dolifleet = new doliFleetVehicule($db);
38 | $elementtype=$dolifleet->table_element; //Must be the $table_element of the class that manage extrafield
39 |
40 | // Page title and texts elements
41 | $textobject=$langs->transnoentitiesnoconv('doliFleet');
42 | $help_url='EN:Help doliFleet|FR:Aide doliFleet';
43 | $pageTitle = $langs->trans('ExtraFields');
44 |
45 | // Configuration header
46 | $head = dolifleetAdminPrepareHead();
47 |
48 |
49 |
50 | /*
51 | * Include of extrafield page
52 | */
53 |
54 | require_once dol_buildpath('abricot/tpl/extrafields_setup.tpl.php'); // use this kind of call for variables scope
55 |
--------------------------------------------------------------------------------
/tpl/linkedobjectblock.tpl.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | // Protection to avoid direct call of template
19 | if (empty($conf) || ! is_object($conf)) {
20 | print "Error, template page can't be called as URL";
21 | exit;
22 | }
23 |
24 | ?>
25 |
26 |
27 |
28 | load("dolifleet@dolifleet");
36 | echo ' ';
37 | print load_fiche_titre($langs->trans("doliFleetRelated"));
38 | ?>
39 |
66 |
67 |
--------------------------------------------------------------------------------
/admin/dolifleet_about.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | /**
19 | * \file admin/about.php
20 | * \ingroup dolifleet
21 | * \brief This file is an example about page
22 | * Put some comments here
23 | */
24 | // Dolibarr environment
25 | $res = @include '../../main.inc.php'; // From htdocs directory
26 | if (! $res) {
27 | $res = @include '../../../main.inc.php'; // From "custom" directory
28 | }
29 |
30 | // Libraries
31 | require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
32 | require_once '../lib/dolifleet.lib.php';
33 |
34 | // Translations
35 | $langs->load('dolifleet@dolifleet');
36 |
37 | // Access control
38 | if (! $user->admin) {
39 | accessforbidden();
40 | }
41 |
42 | /*
43 | * View
44 | */
45 | $page_name = 'doliFleetAbout';
46 | llxHeader('', $langs->trans($page_name));
47 |
48 | // Subheader
49 | $linkback = ''
50 | . $langs->trans('BackToModuleList') . '';
51 | print load_fiche_titre($langs->trans($page_name), $linkback);
52 |
53 | // Configuration header
54 | $head = dolifleetAdminPrepareHead();
55 | dol_fiche_head(
56 | $head,
57 | 'about',
58 | $langs->trans('Module104087Name'),
59 | 0,
60 | 'dolifleet@dolifleet'
61 | );
62 |
63 | // About page goes here
64 | print '
';
65 | print '
'.$langs->trans('ATMAbout').'
';
66 |
67 | dol_fiche_end();
68 |
69 | print '
';
70 | print '';
71 | print '
';
72 |
73 | llxFooter();
74 | $db->close();
75 |
--------------------------------------------------------------------------------
/core/boxes/dolifleet_box.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | /**
19 | * \file core/boxes/mybox.php
20 | * \ingroup dolifleet
21 | * \brief This file is a sample box definition file
22 | * Put some comments here
23 | */
24 | include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php";
25 |
26 | /**
27 | * Class to manage the box
28 | */
29 | class dolifleetbox extends ModeleBoxes
30 | {
31 |
32 | public $boxcode = "mybox";
33 | public $boximg = "dolifleet@dolifleet";
34 | public $boxlabel;
35 | public $depends = array("dolifleet");
36 | public $db;
37 | public $param;
38 | public $info_box_head = array();
39 | public $info_box_contents = array();
40 |
41 | /**
42 | * Constructor
43 | */
44 | public function __construct()
45 | {
46 | global $langs;
47 | $langs->load("boxes");
48 |
49 | $this->boxlabel = $langs->transnoentitiesnoconv("MyBox");
50 | }
51 |
52 | /**
53 | * Load data into info_box_contents array to show array later.
54 | *
55 | * @param int $max Maximum number of records to load
56 | * @return void
57 | */
58 | public function loadBox($max = 5)
59 | {
60 | global $conf, $user, $langs, $db;
61 |
62 | $this->max = $max;
63 |
64 | // dol_include_once('/dolifleet/class/dolifleet.class.php');
65 |
66 | $text = $langs->trans("MyBoxDescription", $max);
67 | $this->info_box_head = array(
68 | 'text' => $text,
69 | 'limit' => dol_strlen($text)
70 | );
71 |
72 | $this->info_box_contents[0][0] = array('td' => 'align="left"',
73 | 'text' => $langs->trans("MyBoxContent"));
74 | }
75 |
76 | /**
77 | * Method to show box
78 | *
79 | * @param array $head Array with properties of box title
80 | * @param array $contents Array with properties of box lines
81 | * @return void
82 | */
83 | public function showBox($head = null, $contents = null)
84 | {
85 | parent::showBox($this->info_box_head, $this->info_box_contents);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/script/create-maj-base.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | /**
19 | * Script créant et vérifiant que les champs requis s'ajoutent bien
20 | */
21 |
22 | if(!defined('INC_FROM_DOLIBARR')) {
23 | define('INC_FROM_CRON_SCRIPT', true);
24 |
25 | require '../config.php';
26 | } else {
27 | global $db;
28 | }
29 |
30 |
31 | /* uncomment
32 | dol_include_once('/dolifleet/class/dolifleet.class.php');
33 |
34 | $o=new doliFleet($db);
35 | $o->init_db_by_vars();
36 | */
37 |
38 | /* Dictionnaries */
39 |
40 | dol_include_once('/dolifleet/class/dictionaryContractType.class.php');
41 | $o=new dictionaryContractType($db);
42 | $o->init_db_by_vars();
43 |
44 | dol_include_once('/dolifleet/class/dictionaryVehiculeType.class.php');
45 | $o=new dictionaryVehiculeType($db);
46 | $o->init_db_by_vars();
47 |
48 | dol_include_once('/dolifleet/class/dictionaryVehiculeMark.class.php');
49 | $o=new dictionaryVehiculeMark($db);
50 | $o->init_db_by_vars();
51 |
52 | dol_include_once('/dolifleet/class/dictionaryVehiculeActivityType.class.php');
53 | $o=new dictionaryVehiculeActivityType($db);
54 | $o->init_db_by_vars();
55 |
56 | /* Objects */
57 |
58 | dol_include_once('/dolifleet/class/vehicule.class.php');
59 | $o=new doliFleetVehicule($db);
60 | $o->init_db_by_vars();
61 |
62 | dol_include_once('/dolifleet/class/vehiculeActivity.class.php');
63 | $o=new doliFleetVehiculeActivity($db);
64 | $o->init_db_by_vars();
65 |
66 | dol_include_once('/dolifleet/class/vehiculeLink.class.php');
67 | $o=new doliFleetVehiculeLink($db);
68 | $o->init_db_by_vars();
69 |
70 | dol_include_once('/dolifleet/class/vehiculeRental.class.php');
71 | $o=new dolifleetVehiculeRental($db);
72 | $o->init_db_by_vars();
73 |
74 | dol_include_once('/dolifleet/class/vehiculeRentalMatrix.class.php');
75 | $o=new doliFleetVehiculeRentalMatrix($db);
76 | $o->init_db_by_vars();
77 |
78 | dol_include_once('/dolifleet/class/vehiculeOperation.class.php');
79 | $o=new dolifleetVehiculeOperation($db);
80 | $o->init_db_by_vars();
81 |
82 | dol_include_once('/dolifleet/class/rentalProposal.class.php');
83 | $o=new dolifleetRentalProposal($db);
84 | $o->init_db_by_vars();
85 |
86 | $o=new dolifleetRentalProposalDet($db);
87 | $o->init_db_by_vars();
88 |
--------------------------------------------------------------------------------
/class/vehiculeRental.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | class dolifleetVehiculeRental extends SeedObject
28 | {
29 | /** @var string $table_element Table name in SQL */
30 | public $table_element = 'dolifleet_vehicule_rental';
31 |
32 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
33 | public $element = 'dolifleet_vehicule_rental';
34 |
35 | public $fk_vehicule;
36 |
37 | public $date_start;
38 |
39 | public $date_end;
40 |
41 | public $total_ht;
42 |
43 | public $fk_soc;
44 |
45 | public $fk_proposaldet;
46 |
47 | public $fields = array(
48 | 'fk_vehicule' => array(
49 | 'type' => 'integer:doliFleetVehicule:dolifleet/class/vehicule.class.php',
50 | 'label' => 'doliFleetVehicule',
51 | 'visible' => 1,
52 | 'enabled' => 1,
53 | 'position' => 10,
54 | 'index' => 1,
55 | ),
56 |
57 | 'date_start' => array(
58 | 'type' => 'date',
59 | 'label' => 'date_start',
60 | 'enabled' => 1,
61 | 'visible' => 1,
62 | 'position' => 70,
63 | 'searchall' => 1,
64 | ),
65 |
66 | 'date_end' => array(
67 | 'type' => 'date',
68 | 'label' => 'date_end',
69 | 'enabled' => 1,
70 | 'visible' => 1,
71 | 'position' => 70,
72 | 'searchall' => 1,
73 | ),
74 |
75 | 'total_ht' => array(
76 | 'type' => 'price',
77 | 'label' => 'totalHT',
78 | 'enabled' => 1,
79 | 'visible' => 1,
80 | 'position' => 80
81 | ),
82 |
83 | 'fk_soc' => array(
84 | 'type' => 'integer:Societe:societe/class/societe.class.php',
85 | 'enabled' => 1,
86 | 'visible' => 0,
87 | 'position' => 90,
88 | 'index' => 1,
89 | ),
90 |
91 | 'fk_proposaldet' => array(
92 | 'type' => 'integer',
93 | 'enabled' => 1,
94 | 'visible' => 0,
95 | 'position' => 100,
96 | 'index' => 1,
97 | ),
98 | );
99 |
100 | public function __construct($db)
101 | {
102 | parent::__construct($db);
103 |
104 | $this->init();
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/class/vehiculeLink.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | class doliFleetVehiculeLink extends SeedObject
28 | {
29 | /** @var string $table_element Table name in SQL */
30 | public $table_element = 'dolifleet_vehicule_link';
31 |
32 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
33 | public $element = 'dolifleet_vehicule_link';
34 |
35 | public $date_start;
36 |
37 | public $date_end;
38 |
39 | public $fk_source;
40 |
41 | public $fk_soc_vehicule_source;
42 |
43 | public $fk_target;
44 |
45 | public $fk_soc_vehicule_target;
46 |
47 | public $fields = array(
48 | 'date_start' => array(
49 | 'type' => 'date',
50 | 'label' => 'date_start',
51 | 'enabled' => 1,
52 | 'visible' => 1,
53 | 'position' => 70,
54 | 'searchall' => 1,
55 | ),
56 |
57 | 'date_end' => array(
58 | 'type' => 'date',
59 | 'label' => 'date_end',
60 | 'enabled' => 1,
61 | 'visible' => 1,
62 | 'position' => 70,
63 | 'searchall' => 1,
64 | ),
65 |
66 | 'fk_source' => array(
67 | 'type' => 'integer:doliFleetVehicule:dolifleet/class/vehicule.class.php',
68 | 'label' => 'doliFleetVehicule',
69 | 'visible' => 1,
70 | 'enabled' => 1,
71 | 'position' => 10,
72 | 'index' => 1,
73 | ),
74 |
75 | 'fk_soc_vehicule_source' => array(
76 | 'type' => 'integer:Societe:societe/class/societe.class.php',
77 | 'label' => 'ThirdParty',
78 | 'visible' => 1,
79 | 'notnull' =>1,
80 | 'default' => 0,
81 | 'enabled' => 1,
82 | 'position' => 80,
83 | 'index' => 1,
84 | 'help' => 'LinkToThirparty'
85 | ),
86 |
87 | 'fk_target' => array(
88 | 'type' => 'integer:doliFleetVehicule:dolifleet/class/vehicule.class.php',
89 | 'label' => 'doliFleetVehicule',
90 | 'visible' => 1,
91 | 'enabled' => 1,
92 | 'position' => 10,
93 | 'index' => 1,
94 | ),
95 |
96 | 'fk_soc_vehicule_target' => array(
97 | 'type' => 'integer:Societe:societe/class/societe.class.php',
98 | 'label' => 'ThirdParty',
99 | 'visible' => 1,
100 | 'notnull' =>1,
101 | 'default' => 0,
102 | 'enabled' => 1,
103 | 'position' => 80,
104 | 'index' => 1,
105 | 'help' => 'LinkToThirparty'
106 | ),
107 | );
108 |
109 | /**
110 | * doliFleetVehiculeActivity constructor.
111 | * @param DoliDB $db Database connector
112 | */
113 | public function __construct($db)
114 | {
115 | global $conf;
116 |
117 | parent::__construct($db);
118 |
119 | $this->init();
120 |
121 | $this->entity = $conf->entity;
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/class/vehiculeRentalMatrix.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | class doliFleetVehiculeRentalMatrix extends SeedObject
28 | {
29 | /** @var string $table_element Table name in SQL */
30 | public $table_element = 'dolifleet_vehicule_rental_matrix';
31 |
32 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
33 | public $element = 'dolifleet_vehicule_rental_matrix';
34 |
35 | public $fk_soc;
36 |
37 | public $fk_c_type_vh;
38 |
39 | public $fk_c_mark_vh;
40 |
41 | public $delay;
42 |
43 | public $amount_ht;
44 |
45 | public $fields = array(
46 | 'fk_soc' => array(
47 | 'type' => 'integer',
48 | 'enabled' => 1,
49 | 'visible' => 0,
50 | 'notnull' =>1,
51 | 'default' => 0,
52 | 'position' => 10,
53 | 'index' => 1,
54 | ),
55 |
56 | 'fk_c_type_vh' => array(
57 | 'type' => 'sellist:c_dolifleet_vehicule_type:label:rowid::active=1',
58 | 'label' => 'vehiculeType',
59 | 'visible' => 1,
60 | 'enabled' => 1,
61 | 'position' => 20,
62 | 'index' => 1,
63 | ),
64 |
65 | 'fk_c_mark_vh' => array(
66 | 'type' => 'sellist:c_dolifleet_vehicule_mark:label:rowid::active=1',
67 | 'label' => 'vehiculeMark',
68 | 'visible' => 1,
69 | 'enabled' => 1,
70 | 'position' => 30,
71 | 'index' => 1,
72 | ),
73 |
74 | 'delay' => array(
75 | 'type' => 'integer',
76 | 'label' => 'vehiculeDelayExploit',
77 | 'visible' => 1,
78 | 'enabled' => 1,
79 | 'position' => 40,
80 | 'index' => 1,
81 | ),
82 |
83 | 'amount_ht' => array(
84 | 'type' => 'double',
85 | 'label' => 'totalHT',
86 | 'enabled' => 1,
87 | 'visible' => 1,
88 | 'position' => 50
89 | ),
90 |
91 | );
92 |
93 | public function __construct($db)
94 | {
95 | parent::__construct($db);
96 |
97 | $this->init();
98 | }
99 |
100 | public function create(User &$user, $notrigger = false)
101 | {
102 | global $langs;
103 |
104 | // check parameters
105 | if (empty($this->fk_c_type_vh) || $this->fk_c_type_vh == -1) $this->errors[] = $langs->trans('ErrInvalidType');
106 | if (empty($this->fk_c_mark_vh) || $this->fk_c_mark_vh == -1) $this->errors[] = $langs->trans('ErrInvalidMark');
107 | if (empty($this->delay)) $this->errors[] = $langs->trans('ErrNoDelayForLine');
108 | if (empty($this->amount_ht)) $this->errors[] = $langs->trans('ErrInvalidAmount');
109 |
110 | if (empty($this->id))
111 | {
112 | $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.$this->table_element;
113 | $sql.= " WHERE fk_soc = " . $this->fk_soc;
114 | $sql.= " AND fk_c_type_vh = ".$this->fk_c_type_vh;
115 | $sql.= " AND fk_c_mark_vh = ".$this->fk_c_mark_vh;
116 | $sql.= " AND delay = ".$this->delay;
117 | $resql = $this->db->query($sql);
118 | if ($resql)
119 | {
120 | $obj = $this->db->fetch_object($resql);
121 | if ($obj->nb > 0) $this->errors[] = $langs->trans('ErrDuplicateMatrix');
122 | }
123 | }
124 |
125 |
126 | if (!empty($this->errors)) return -1;
127 |
128 | return parent::create($user, $notrigger); // TODO: Change the autogenerated stub
129 | }
130 |
131 |
132 | }
133 |
--------------------------------------------------------------------------------
/class/vehiculeActivity.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | class doliFleetVehiculeActivity extends SeedObject
28 | {
29 | /** @var string $table_element Table name in SQL */
30 | public $table_element = 'dolifleet_vehicule_activity';
31 |
32 | /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */
33 | public $element = 'dolifleet_vehicule_activity';
34 |
35 | /** @var int $fk_vehicule Object link to vehicule */
36 | public $fk_vehicule;
37 |
38 | /** @var int $fk_type Object type */
39 | public $fk_type;
40 |
41 | public $fk_soc;
42 |
43 | public $date_start;
44 |
45 | public $date_end;
46 |
47 | public $fields = array(
48 | 'fk_vehicule' => array(
49 | 'type' => 'integer:doliFleetVehicule:dolifleet/class/vehicule.class.php',
50 | 'label' => 'doliFleetVehicule',
51 | 'visible' => 1,
52 | 'enabled' => 1,
53 | 'notnull' => 1,
54 | 'position' => 10,
55 | 'index' => 1,
56 | ),
57 |
58 | 'fk_type' => array(
59 | 'type' => 'sellist:c_dolifleet_vehicule_activity_type:label:rowid::active=1',
60 | 'label' => 'vehiculeMark',
61 | 'visible' => 1,
62 | 'enabled' => 1,
63 | 'notnull' => 1,
64 | 'position' => 50,
65 | 'index' => 1,
66 | ),
67 |
68 | 'date_start' => array(
69 | 'type' => 'date',
70 | 'label' => 'date_start',
71 | 'enabled' => 1,
72 | 'visible' => 1,
73 | 'position' => 70,
74 | 'searchall' => 1,
75 | ),
76 |
77 | 'date_end' => array(
78 | 'type' => 'date',
79 | 'label' => 'date_end',
80 | 'enabled' => 1,
81 | 'visible' => 1,
82 | 'position' => 70,
83 | 'searchall' => 1,
84 | ),
85 |
86 | 'fk_soc' => array(
87 | 'type' => 'integer:Societe:societe/class/societe.class.php',
88 | 'label' => 'ThirdParty',
89 | 'visible' => 1,
90 | 'enabled' => 1,
91 | 'position' => 80,
92 | 'index' => 1,
93 | 'help' => 'LinkToThirparty'
94 | ),
95 | );
96 |
97 | /**
98 | * doliFleetVehiculeActivity constructor.
99 | * @param DoliDB $db Database connector
100 | */
101 | public function __construct($db)
102 | {
103 | global $conf;
104 |
105 | parent::__construct($db);
106 |
107 | $this->init();
108 |
109 | $this->entity = $conf->entity;
110 | }
111 |
112 | public function getType()
113 | {
114 | dol_include_once('/dolifleet/class/dictionaryVehiculeActivityType.class.php');
115 | $dict = new dictionaryVehiculeActivityType($this->db);
116 |
117 | if (!empty($this->fk_type))
118 | {
119 | return $dict->getValueFromId($this->fk_type);
120 | }
121 |
122 | return '';
123 | }
124 |
125 | public function verifyDates()
126 | {
127 | global $langs;
128 |
129 | $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.$this->table_element;
130 | $sql.= " WHERE fk_vehicule = ". $this->fk_vehicule;
131 | if (!empty($this->date_start)) $sql.= " AND date_end > '" . $this->db->idate($this->date_start) ."'";
132 | if (!empty($this->date_end)) $sql.= " AND date_start < '" . $this->db->idate($this->date_end) . "'";
133 |
134 | $resql = $this->db->query($sql);
135 | if ($resql)
136 | {
137 | $obj = $this->db->fetch_object($resql);
138 |
139 | if (empty($obj->nb)) return true;
140 | else $this->error = $langs->trans('ErrAlreadyInActivity');
141 | }
142 | else $this->error = $this->db->lasterror();
143 |
144 | return false;
145 | }
146 |
147 | }
148 |
--------------------------------------------------------------------------------
/core/modules/dolifleet/modules_rentalproposal.php:
--------------------------------------------------------------------------------
1 |
3 | * Copyright (C) 2004-2011 Laurent Destailleur
4 | * Copyright (C) 2004 Eric Seigne
5 | * Copyright (C) 2005-2012 Regis Houssin
6 | * Copyright (C) 2006 Andre Cianfarani
7 | * Copyright (C) 2012 Juanjo Menent
8 | * Copyright (C) 2014 Marcos García
9 | *
10 | * This program is free software; you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation; either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | * or see https://www.gnu.org/
23 | */
24 |
25 | /**
26 | * \file modules/dolifleet/modules_rentalproposal.php
27 | * \ingroup dolifleet
28 | * \brief File that contains parent class for orders models
29 | * and parent class for orders numbering models
30 | */
31 |
32 | require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
33 |
34 | /**
35 | * Parent class for rentalproposal models
36 | */
37 | abstract class ModelePDFRentalproposal extends CommonDocGenerator
38 | {
39 |
40 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
41 | /**
42 | * Return list of active generation modules
43 | *
44 | * @param DoliDB $db Database handler
45 | * @param integer $maxfilenamelength Max length of value to show
46 | * @return array List of templates
47 | */
48 | public static function liste_modeles($db, $maxfilenamelength = 0)
49 | {
50 | // phpcs:enable
51 | global $conf;
52 |
53 | $type = 'rentalproposal';
54 | $list = array();
55 |
56 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
57 | $list = getListOfModels($db, $type, $maxfilenamelength);
58 |
59 | return $list;
60 | }
61 | }
62 |
63 |
64 |
65 | /**
66 | * Parent class to manage numbering Processrules
67 | */
68 | abstract class ModeleNumRefRentalproposal
69 | {
70 | /**
71 | * @var string Error code (or message)
72 | */
73 | public $error='';
74 |
75 | /**
76 | * Return if a module can be used or not
77 | *
78 | * @return boolean true if module can be used
79 | */
80 | public function isEnabled()
81 | {
82 | return true;
83 | }
84 |
85 | /**
86 | * Renvoie la description par defaut du modele de numerotation
87 | *
88 | * @return string Texte descripif
89 | */
90 | public function info()
91 | {
92 | global $langs;
93 | $langs->load("processrules@processrules");
94 | return $langs->trans("NoDescription");
95 | }
96 |
97 | /**
98 | * Renvoie un exemple de numerotation
99 | *
100 | * @return string Example
101 | */
102 | public function getExample()
103 | {
104 | global $langs;
105 | $langs->load("processrules@processrules");
106 | return $langs->trans("NoExample");
107 | }
108 |
109 | /**
110 | * Checks if the numbers already in force in the data base do not
111 | * cause conflicts that would prevent this numbering from working.
112 | *
113 | * @return boolean false if conflict, true if ok
114 | */
115 | public function canBeActivated()
116 | {
117 | return true;
118 | }
119 |
120 | /**
121 | * Returns next assigned value
122 | *
123 | * @param Societe $objsoc Object thirdparty
124 | * @param Object $object Object we need next value for
125 | * @return string Valeur
126 | */
127 | public function getNextValue($objsoc, $object)
128 | {
129 | global $langs;
130 | return $langs->trans("NotAvailable");
131 | }
132 |
133 | /**
134 | * Returns version of numbering module
135 | *
136 | * @return string Valeur
137 | */
138 | public function getVersion()
139 | {
140 | global $langs;
141 | $langs->load("admin");
142 |
143 | if ($this->version == 'development') return $langs->trans("VersionDevelopment");
144 | if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
145 | if ($this->version == 'dolibarr') return DOL_VERSION;
146 | if ($this->version) return $this->version;
147 | return $langs->trans("NotAvailable");
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/class/dictionary.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | if (!class_exists('SeedObject'))
19 | {
20 | /**
21 | * Needed if $form->showLinkedObjectBlock() is call or for session timeout on our module page
22 | */
23 | define('INC_FROM_DOLIBARR', true);
24 | require_once dirname(__FILE__).'/../config.php';
25 | }
26 |
27 | abstract class dictionary extends SeedObject
28 | {
29 |
30 | /** @var string $code Object reference */
31 | public $code;
32 |
33 | /** @var int $entity Object entity */
34 | public $entity;
35 |
36 | /** @var int $active Object active */
37 | public $active;
38 |
39 | /** @var int $label Object name */
40 | public $label;
41 |
42 | /**
43 | * 'type' is the field format.
44 | * 'label' the translation key.
45 | * 'enabled' is a condition when the field must be managed.
46 | * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
47 | * 'noteditable' says if field is not editable (1 or 0)
48 | * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
49 | * 'default' is a default value for creation (can still be replaced by the global setup of default values)
50 | * 'index' if we want an index in database.
51 | * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
52 | * 'position' is the sort order of field.
53 | * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
54 | * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
55 | * 'css' is the CSS style to use on field. For example: 'maxwidth200'
56 | * 'help' is a string visible as a tooltip on field
57 | * 'comment' is not used. You can store here any text of your choice. It is not used by application.
58 | * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
59 | * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
60 | */
61 |
62 | public $fields = array(
63 |
64 | 'code' => array(
65 | 'type' => 'varchar(20)',
66 | 'length' => 20,
67 | 'label' => 'Code',
68 | 'enabled' => 1,
69 | 'visible' => 1,
70 | 'notnull' => 1,
71 | 'index' => 1,
72 | ),
73 |
74 | 'entity' => array(
75 | 'type' => 'integer',
76 | 'label' => 'Entity',
77 | 'enabled' => 1,
78 | 'visible' => 0,
79 | 'default' => 1,
80 | 'notnull' => 1,
81 | 'index' => 1,
82 | 'position' => 20
83 | ),
84 |
85 | 'active' => array(
86 | 'type' => 'integer',
87 | 'label' => 'Active',
88 | 'enabled' => 1,
89 | 'visible' => 0,
90 | 'notnull' => 1,
91 | 'default' => 0,
92 | 'index' => 1,
93 | 'position' => 30,
94 | 'arrayofkeyval' => array(
95 | 0 => 'Disabled',
96 | 1 => 'Active'
97 | )
98 | ),
99 |
100 | 'label' => array(
101 | 'type' => 'varchar(255)',
102 | 'label' => 'Label',
103 | 'enabled' => 1,
104 | 'visible' => 1,
105 | 'position' => 40,
106 | 'searchall' => 1,
107 | 'css' => 'minwidth200',
108 | 'showoncombobox' => 1
109 | ),
110 |
111 | );
112 |
113 | /**
114 | * Dictionnary constructor.
115 | * @param DoliDB $db Database connector
116 | */
117 | public function __construct($db)
118 | {
119 | global $conf;
120 |
121 | parent::__construct($db);
122 |
123 | $this->init();
124 |
125 | $this->entity = $conf->entity;
126 | }
127 |
128 | /**
129 | * @param User $user User object
130 | * @return int
131 | */
132 | public function save($user)
133 | {
134 | return $this->create($user);
135 | }
136 |
137 | public function getAllActiveArray($field = '')
138 | {
139 | $Tab = array();
140 |
141 | $sql = 'SELECT rowid';
142 | if (!empty($field)) $sql.= ', '.$field;
143 | $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
144 | $sql.= ' WHERE active=1';
145 | $sql.= ' AND entity IN ('.getEntity('dolifleet').')';
146 |
147 | $resql = $this->db->query($sql);
148 | if ($resql)
149 | {
150 | while ($obj = $this->db->fetch_object($resql))
151 | {
152 | $Tab[$obj->rowid] = empty($field) ? $obj->rowid : $obj->{$field};
153 | }
154 | return $Tab;
155 | }
156 | else
157 | {
158 | return -1;
159 | }
160 | }
161 |
162 | public function getValueFromId($id, $field = 'label')
163 | {
164 | global $langs;
165 |
166 | $dict = new static($this->db);
167 | $ret = $dict->fetch($id);
168 | if ($ret > 0 && isset($dict->{$field}))
169 | {
170 | return $dict->{$field};
171 | }
172 |
173 | return '';
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/rental_proposal_list.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | require 'config.php';
19 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
20 | dol_include_once('dolifleet/class/rentalProposal.class.php');
21 |
22 | if(empty($user->rights->dolifleet->rentalproposal->read)) accessforbidden();
23 |
24 | $langs->load('abricot@abricot');
25 | $langs->load('dolifleet@dolifleet');
26 |
27 |
28 | $massaction = GETPOST('massaction', 'alpha');
29 | $confirmmassaction = GETPOST('confirmmassaction', 'alpha');
30 | $toselect = GETPOST('toselect', 'array');
31 |
32 | $object = new dolifleetRentalProposal($db);
33 |
34 | $hookmanager->initHooks(array('dolifleetrentalproposallist'));
35 |
36 | if ($object->isextrafieldmanaged)
37 | {
38 | $extrafields = new ExtraFields($db);
39 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
40 | }
41 |
42 | /*
43 | * Actions
44 | */
45 |
46 | $parameters=array();
47 | $reshook=$hookmanager->executeHooks('doActions', $parameters, $object); // Note that $action and $object may have been modified by some hooks
48 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
49 |
50 | if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend')
51 | {
52 | $massaction = '';
53 | }
54 |
55 | if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha'))
56 | {
57 | unset($_GET['Listview_dolifleetrentalproposal_search_fk_soc']);
58 | }
59 |
60 | if (empty($reshook))
61 | {
62 | // do action from GETPOST ...
63 | }
64 |
65 |
66 | /*
67 | * View
68 | */
69 |
70 | llxHeader('', $langs->trans('dolifleetRentalProposalList'), '', '');
71 |
72 | //$type = GETPOST('type');
73 | //if (empty($user->rights->dolifleetrentalproposal->all->read)) $type = 'mine';
74 |
75 | // TODO ajouter les champs de son objet que l'on souhaite afficher
76 | $keys = array_keys($object->fields);
77 | $fieldList = 't.'.implode(', t.', $keys);
78 | if (!empty($object->isextrafieldmanaged))
79 | {
80 | $keys = array_keys($extralabels);
81 | if(!empty($keys)) {
82 | $fieldList .= ', et.' . implode(', et.', $keys);
83 | }
84 | }
85 |
86 | $sql = 'SELECT '.$fieldList;
87 |
88 | // Add fields from hooks
89 | $parameters=array('sql' => $sql);
90 | $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
91 | $sql.=$hookmanager->resPrint;
92 |
93 | $sql.= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' t ';
94 |
95 | if (!empty($object->isextrafieldmanaged))
96 | {
97 | $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.$object->table_element.'_extrafields et ON (et.fk_object = t.rowid)';
98 | }
99 |
100 | $sql.= ' WHERE 1=1';
101 | //$sql.= ' AND t.entity IN ('.getEntity('dolifleetRentalProposal', 1).')';
102 | //if ($type == 'mine') $sql.= ' AND t.fk_user = '.$user->id;
103 |
104 | // Add where from hooks
105 | $parameters=array('sql' => $sql);
106 | $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
107 | $sql.=$hookmanager->resPrint;
108 |
109 | $formcore = new TFormCore($_SERVER['PHP_SELF'], 'form_list_dolifleetrentalproposal', 'GET');
110 |
111 | $nbLine = GETPOST('limit');
112 | if (empty($nbLine)) $nbLine = !empty($user->conf->MAIN_SIZE_LISTE_LIMIT) ? $user->conf->MAIN_SIZE_LISTE_LIMIT : $conf->global->MAIN_SIZE_LISTE_LIMIT;
113 |
114 | // List configuration
115 | $listViewConfig = array(
116 | 'view_type' => 'list' // default = [list], [raw], [chart]
117 | ,'allow-fields-select' => true
118 | ,'limit'=>array(
119 | 'nbLine' => $nbLine
120 | )
121 | ,'list' => array(
122 | 'title' => $langs->trans('dolifleetRentalProposalList')
123 | ,'image' => 'title_generic.png'
124 | ,'picto_precedent' => '<'
125 | ,'picto_suivant' => '>'
126 | ,'noheader' => 0
127 | ,'messageNothing' => $langs->trans('NodoliFleet')
128 | ,'picto_search' => img_picto('', 'search.png', '', 0)
129 | ,'param_url' => '&limit='.$nbLine
130 | // ,'massactions'=>array(
131 | // 'yourmassactioncode' => $langs->trans('YourMassActionLabel')
132 | // )
133 | )
134 | ,'subQuery' => array()
135 | ,'link' => array()
136 | ,'type' => array(
137 | 'date_creation' => 'date' // [datetime], [hour], [money], [number], [integer]
138 | ,'tms' => 'date'
139 | )
140 | ,'search' => array(
141 | 'date_creation' => array('search_type' => 'calendars', 'allow_is_null' => true)
142 | ,'ref' => array('search_type' => true, 'table' => 't', 'field' => 'ref')
143 | // ,'tms' => array('search_type' => 'calendars', 'allow_is_null' => false)
144 | // ,'label' => array('search_type' => true, 'table' => array('t', 't'), 'field' => array('label')) // input text de recherche sur plusieurs champs
145 | ,'status' => array('search_type' => dolifleetRentalProposal::$TStatus, 'to_translate' => true) // select html, la clé = le status de l'objet, 'to_translate' à true si nécessaire
146 | ,'month' => array('search_type' => monthArray($langs))
147 | ,'year' => array('search_type' => true, 'table' => 't', 'field', 'year')
148 | ,'fk_soc' => array('search_type' => 'override', 'override' => $object->showInputField($object->fields['fk_soc'], 'fk_soc', GETPOST('Listview_dolifleetrentalproposal_search_fk_soc'),'','','Listview_dolifleetrentalproposal_search_'))
149 | )
150 | ,'translate' => array()
151 | ,'hide' => array(
152 | 'rowid' // important : rowid doit exister dans la query sql pour les checkbox de massaction
153 | )
154 | ,'title'=>array(
155 | 'ref' => $langs->trans('Ref.')
156 | // ,'label' => $langs->trans('Label')
157 | // ,'date_creation' => $langs->trans('DateCre')
158 | // ,'tms' => $langs->trans('DateMaj')
159 | // ,'id'=>$langs->trans('Id')
160 | ,'month' => $langs->trans('Month')
161 | ,'year' => $langs->trans('Year')
162 | ,'fk_soc'=> $langs->trans('ThirdParty')
163 | ,'status'=> $langs->trans('Status')
164 | )
165 | ,'eval'=>array(
166 | 'ref' => '_getObjectNomUrl(\'@rowid@\')'
167 | ,'fk_soc' => '_getObjectNomUrl(\'@val@\', "Societe")'
168 | ,'month' => '_displayMonth(@val@)'
169 | ,'status' => "_printStatus(@val@)"
170 | // ,'fk_user' => '_getUserNomUrl(@val@)' // Si on a un fk_user dans notre requête
171 | )
172 | );
173 |
174 | $r = new Listview($db, 'dolifleetrentalproposal');
175 |
176 | // Change view from hooks
177 | $parameters=array( 'listViewConfig' => $listViewConfig);
178 | $reshook=$hookmanager->executeHooks('listViewConfig',$parameters,$r); // Note that $action and $object may have been modified by hook
179 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
180 | if ($reshook>0)
181 | {
182 | $listViewConfig = $hookmanager->resArray;
183 | }
184 |
185 | echo $r->render($sql, $listViewConfig);
186 |
187 | $parameters=array('sql'=>$sql);
188 | $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
189 | print $hookmanager->resPrint;
190 |
191 | $formcore->end_form();
192 |
193 | llxFooter('');
194 | $db->close();
195 |
196 | /**
197 | * TODO remove if unused
198 | */
199 | function _getObjectNomUrl($id, $classname = 'dolifleetRentalProposal')
200 | {
201 |
202 | global $db;
203 |
204 | if ($classname == 'Societe') require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
205 |
206 | $o = new $classname($db);
207 | if ($classname == 'dolifleetRentalProposal') $res = $o->fetch($id, false, '');
208 | else $res = $o->fetch($id);
209 | if ($res > 0)
210 | {
211 | return $o->getNomUrl(1);
212 | }
213 |
214 | return '';
215 | }
216 |
217 | function _printStatus($fk_status)
218 | {
219 | global $langs;
220 |
221 | return $langs->trans(dolifleetRentalProposal::$TStatus[$fk_status]);
222 | }
223 |
224 | function _displayMonth($monthNumber)
225 | {
226 | global $langs, $TMonth;
227 |
228 | if (empty($TMonth)) $TMonth = monthArray($langs);
229 |
230 | return $TMonth[$monthNumber];
231 |
232 | }
233 |
234 | /**
235 | * TODO remove if unused
236 | */
237 | function _getUserNomUrl($fk_user)
238 | {
239 | global $db;
240 |
241 | $u = new User($db);
242 | if ($u->fetch($fk_user) > 0)
243 | {
244 | return $u->getNomUrl(1);
245 | }
246 |
247 | return '';
248 | }
249 |
--------------------------------------------------------------------------------
/admin/multicompany_sharing.php:
--------------------------------------------------------------------------------
1 | load("admin");
20 | $langs->load("dolifleet@dolifleet");
21 |
22 | // Merci à dolibarr et multicompany de simplifier les choses...
23 | $moduleKey = 'dolifleet';
24 | $element = 'dolifleet';
25 | $elementConvertion = 'dolifleetvehicule'; // voir selectForForms dans html.form.class.php
26 | $elementConvertionAnotherOne = 'dolifleet_vehicule'; // voir selectForFormsList dans html.form.class.php
27 |
28 |
29 | $moduleSharingEnabled = 'MULTICOMPANY_'.strtoupper($moduleKey).'_SHARING_ENABLED';
30 | $moduleSharingEnabledValue = $conf->global->{$moduleSharingEnabled};
31 |
32 | dolibarr_set_const($db, 'MULTICOMPANY_'.strtoupper($elementConvertion).'_SHARING_ENABLED' , $moduleSharingEnabledValue, 'chaine', 0, '', 0); // la conf MULTICOMPANY_EXTERNAL_MODULES_SHARING regle le PB je les garde au cas ou
33 | dolibarr_set_const($db, 'MULTICOMPANY_'.strtoupper($elementConvertionAnotherOne).'_SHARING_ENABLED' , $moduleSharingEnabledValue, 'chaine', 0, '', 0); // la conf MULTICOMPANY_EXTERNAL_MODULES_SHARING regle le PB je les garde au cas ou
34 |
35 | $externalmodules = array();
36 | if (! empty($conf->global->MULTICOMPANY_EXTERNAL_MODULES_SHARING)) {
37 | $externalmodules = json_decode($conf->global->MULTICOMPANY_EXTERNAL_MODULES_SHARING, true);
38 | }
39 |
40 | if(!empty($moduleSharingEnabledValue)){
41 | $externalmodules[$moduleKey]['sharingmodulename'][$elementConvertion] = 'dolifleet';
42 | $externalmodules[$moduleKey]['sharingmodulename'][$elementConvertionAnotherOne] = 'dolifleet';
43 | dolibarr_set_const($db, 'MULTICOMPANY_EXTERNAL_MODULES_SHARING' , json_encode($externalmodules), 'chaine', 0, '', 0);
44 | }
45 |
46 | $action = GETPOST("action");
47 | if ($action == 'save_multicompany_shared_conf')
48 | {
49 | $multicompanypriceshare = GETPOST('multicompany-dolifleet', 'array');
50 | $dao = new DaoMulticompany($db);
51 | $dao->getEntities();
52 |
53 | foreach ($dao->entities as $entity)
54 | {
55 | $entity->options['sharings'][$element] = $entity->options['sharings'][$elementConvertion] = $entity->options['sharings'][$elementConvertionAnotherOne] = array();
56 | $entity->update($entity->id, $user);
57 | }
58 |
59 | if (!empty($multicompanypriceshare))
60 | {
61 |
62 | foreach ($multicompanypriceshare as $entityId => $shared)
63 | {
64 |
65 | //'MULTICOMPANY_'.strtoupper($element).'_SHARING_ENABLED
66 | if (is_array($shared))
67 | {
68 | $shared = array_map('intval', $shared);
69 |
70 | if ($dao->fetch($entityId) > 0)
71 | {
72 | $dao->options['sharings'][$element] = $dao->options['sharings'][$elementConvertion] = $dao->options['sharings'][$elementConvertionAnotherOne] = $shared;
73 | $dao->options['sharings'][$elementConvertion] = $dao->options['sharings'][$element];
74 | $dao->options['sharings'][$elementConvertionAnotherOne] = $dao->options['sharings'][$element];
75 |
76 | if ($dao->update($entityId, $user) < 1)
77 | {
78 | setEventMessage('Error');
79 | }
80 | }
81 | }
82 | }
83 | }
84 | }
85 |
86 |
87 | $extrajs = $extracss = array();
88 | if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_SHARINGS_ENABLED))
89 | {
90 | $extrajs = array(
91 | '/multicompany/inc/multiselect/js/ui.multiselect.js',
92 | );
93 | $extracss = array(
94 | '/multicompany/inc/multiselect/css/ui.multiselect.css',
95 | );
96 | }
97 |
98 | llxHeader('', $langs->trans('multicompanySharing'), '', '', '', '', $extrajs, $extracss);
99 |
100 |
101 |
102 | $linkback = ''.$langs->trans("BackToModuleList").'';
103 | print_fiche_titre($langs->trans("multicompanySharing"), $linkback, 'setup');
104 |
105 | // Configuration header
106 | $head = dolifleetAdminPrepareHead();
107 | dol_fiche_head($head, 'multicompanySharing', $langs->trans("Module104087Name"), 0, "dolifleet@dolifleet");
108 |
109 |
110 |
111 | if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_SHARINGS_ENABLED))
112 | {
113 |
114 | print '
';
115 |
116 | //var_dump($mc);
117 | print '';
181 |
182 | $langs->loadLangs(array('languages', 'multicompany@multicompany'));
183 |
184 | print '';
199 | }
200 |
201 |
202 | llxFooter();
203 |
204 | /**
205 | * Return multiselect list of entities.
206 | *
207 | * @param string $htmlname Name of select
208 | * @param DaoMulticompany $current Current entity to manage
209 | * @param string $option Option
210 | * @return string
211 | */
212 | function _multiselect_entities($htmlname, $current, $option = '', $sharingElement = '')
213 | {
214 | global $conf, $langs, $db;
215 |
216 | $dao = new DaoMulticompany($db);
217 | $dao->getEntities();
218 |
219 | $sharingElement = !empty($sharingElement) ? $sharingElement : $htmlname;
220 |
221 | $return = '';
245 |
246 | return $return;
247 | }
248 |
--------------------------------------------------------------------------------
/class/actions_dolifleet.class.php:
--------------------------------------------------------------------------------
1 |
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | /**
19 | * \file class/actions_dolifleet.class.php
20 | * \ingroup dolifleet
21 | * \brief This file is an example hook overload class file
22 | * Put some comments here
23 | */
24 |
25 | /**
26 | * Class ActionsdoliFleet
27 | */
28 | class ActionsdoliFleet
29 | {
30 | /**
31 | * @var DoliDb Database handler (result of a new DoliDB)
32 | */
33 | public $db;
34 |
35 | /**
36 | * @var array Hook results. Propagated to $hookmanager->resArray for later reuse
37 | */
38 | public $results = array();
39 |
40 | /**
41 | * @var string String displayed by executeHook() immediately after return
42 | */
43 | public $resprints;
44 |
45 | /**
46 | * @var array Errors
47 | */
48 | public $errors = array();
49 |
50 | /**
51 | * Constructor
52 | * @param DoliDB $db Database connector
53 | */
54 | public function __construct($db)
55 | {
56 | $this->db = $db;
57 | }
58 |
59 | /**
60 | * Overloading the doActions function : replacing the parent's function with the one below
61 | *
62 | * @param array() $parameters Hook metadatas (context, etc...)
63 | * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
64 | * @param string $action Current action (if set). Generally create or edit or null
65 | * @param HookManager $hookmanager Hook manager propagated to allow calling another hook
66 | * @return int < 0 on error, 0 on success, 1 to replace standard code
67 | */
68 | public function doActions($parameters, &$object, &$action, $hookmanager)
69 | {
70 | global $conf, $langs, $user, $db;
71 | $contextArray = explode(':', $parameters['context']);
72 |
73 | if (in_array('operationordercard', $contextArray) && $action == 'clone') {
74 | $action = 'cloneOR';
75 | }
76 |
77 | if (in_array('operationordercard', $contextArray) && $action == 'confirm_cloneOR' && !empty($user->rights->operationorder->write)) {
78 | $newid = $object->cloneObject($user);
79 | $new_fk_vehicule = GETPOST('select_fk_vehicule');
80 | $sql = 'SELECT fk_soc, km FROM '.MAIN_DB_PREFIX.'dolifleet_vehicule WHERE rowid ='.$new_fk_vehicule;
81 | $resql = $db->query($sql);
82 | if($resql){
83 | $obj = $db->fetch_object($resql);
84 | $object->array_options['options_fk_dolifleet_vehicule'] = $new_fk_vehicule;
85 | $object->fk_soc = $obj->fk_soc;
86 | $object->array_options['options_km_on_creation'] = $obj->km;
87 | $object->update($user);
88 | if ($newid > 0) {
89 | setEventMessage('OperationOrderCloned');
90 | header('Location: ' . dol_buildpath('/operationorder/operationorder_card.php', 1) . '?id=' . $object->id);
91 | exit;
92 | } else {
93 | setEventMessage('OperationOrderCloneError', 'errors');
94 | }
95 | } else {
96 | dol_print_error($db);
97 | }
98 | }
99 | }
100 |
101 | public function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager){
102 |
103 | global $conf, $langs, $user, $db;
104 | $contextArray = explode(':', $parameters['context']);
105 |
106 | if (in_array('operationordercard', $contextArray) && $action == 'cloneOR') {
107 | $form = new Form($db);
108 | $fk_status = GETPOST('fk_status' , 'int');
109 | $formquestion = array ( 'text' => $langs->trans("ConfirmClone"),
110 | array('type' => 'other', 'name' => 'select_fk_vehicule', 'label' => $langs->trans("SelectVehicule"), 'value' => $form->selectForForms('doliFleetVehicule:dolifleet/class/vehicule.class.php', "select_fk_vehicule", $object->array_options['options_fk_dolifleet_vehicule'])));
111 | $body = $langs->trans('ConfirmCloneOperationOrderBody', $object->ref);
112 | $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id.'&fk_status='.$fk_status, $langs->trans('ConfirmCloneOperationOrderTitle'), $body, 'confirm_cloneOR', $formquestion, 0, 1);
113 | print $formconfirm;
114 | }
115 |
116 |
117 | /*$error = 0; // Error counter
118 | $myvalue = 'test'; // A result value
119 |
120 | print_r($parameters);
121 | echo "action: " . $action;
122 | print_r($object);
123 |
124 | if (in_array('somecontext', explode(':', $parameters['context']))) {
125 | // do something only for the context 'somecontext'
126 | }
127 |
128 | if (!$error) {
129 | $this->results = array('myreturn' => $myvalue);
130 | $this->resprints = 'A text to show';
131 | return 0; // or return 1 to replace standard code
132 | } else {
133 | $this->errors[] = 'Error message';
134 | return -1;
135 | }*/
136 | }
137 |
138 | public function completeTabsHead($parameters, &$object, &$action, $hookmanager)
139 | {
140 | global $langs;
141 |
142 | if (!empty($parameters['object']) && is_object($parameters['object']) && get_class($parameters['object']) == "Societe" && $parameters['mode'] == 'add')
143 | {
144 | $this->results = $parameters['head'];
145 | $this->results[] = array(
146 | dol_buildpath('dolifleet/matrix_tab.php?socid='.$parameters['object']->id, 1),
147 | $langs->trans('rentalMatrix'),
148 | 'matrix'
149 | );
150 |
151 | return 1;
152 | }
153 | }
154 |
155 | /**
156 | * addSearchEntry Method Hook Call
157 | *
158 | * @param array $parameters parameters
159 | * @param Object &$object Object to use hooks on
160 | * @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
161 | * @param object $hookmanager class instance
162 | * @return void
163 | */
164 | public function addSearchEntry($parameters, &$object, &$action, $hookmanager)
165 | {
166 | global $conf, $langs, $user, $db;
167 | $langs->load('dolifleet@dolifleet');
168 |
169 | dol_include_once('/dolifleet/core/modules/moddoliFleet.class.php');
170 | $modDolifleet = new moddoliFleet($db);
171 |
172 | $arrayresult = array();
173 | if (empty($conf->global->DOLIFLEET_HIDE_QUICK_SEARCH) && $user->rights->dolifleet->read) {
174 | $str_search_vin = '&Listview_dolifleet_search_vin=' . urlencode($parameters['search_boxvalue']);
175 | $arrayresult['searchintovehiculevin'] = array(
176 | 'position' => $modDolifleet->numero,
177 | 'text' => img_object('', 'dolifleet@dolifleet') . ' VIN',
178 | 'url' => dol_buildpath('/dolifleet/vehicule_list.php', 1) . '?search_by=Listview_dolifleet_search_vin'.$str_search_vin
179 | );
180 |
181 | $str_search_immat = '&Listview_dolifleet_search_immatriculation=' . urlencode($parameters['search_boxvalue']);
182 | $arrayresult['searchintovehiculeimmat'] = array(
183 | 'position' => $modDolifleet->numero,
184 | 'text' => img_object('', 'dolifleet@dolifleet') . ' Immat',
185 | 'url' => dol_buildpath('/dolifleet/vehicule_list.php', 1) . '?search_by=Listview_dolifleet_search_immatriculation'.$str_search_immat
186 | );
187 |
188 | }
189 |
190 | $this->results = $arrayresult;
191 |
192 | return 0;
193 | }
194 |
195 | public function formBuilddocOptions($parameters, &$object, &$action, $hookmanager)
196 | {
197 | // var_dump($parameters);
198 | }
199 |
200 | /**
201 | * @param bool $parameters
202 | * @param $object
203 | * @param string $action
204 | * @return int
205 | */
206 | public function moreHtmlRef($parameters=false, &$object, &$action='')
207 | {
208 | global $conf;
209 | global $mc;
210 |
211 | // if global sharings is enabled
212 | if (! empty($conf->global->MULTICOMPANY_SHARINGS_ENABLED)
213 | && ! empty($conf->global->MULTICOMPANY_DOLIFLEET_SHARING_ENABLED)
214 | && $object->element == 'dolifleet_vehicule'
215 | && ! empty($conf->dolifleet->enabled)
216 | && ! empty($mc->sharings['dolifleet_vehicule'])
217 | && $object->entity!=$conf->entity)
218 | {
219 | dol_include_once('/multicompany/class/actions_multicompany.class.php');
220 | $actMulticomp= new ActionsMulticompany($this->db);
221 | $actMulticomp->getInfo($object->entity);
222 |
223 | $this->resprints = "\n" . '' . "\n";
224 |
225 | $this->resprints .= '