@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \brief Fichier contenant la classe du modele de numerotation de reference de commande Saphir |
26 | 26 | */ |
27 | 27 | |
28 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/commande/modules_commande.php'; |
|
28 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * Dolibarr version of the loaded document |
38 | 38 | * @public string |
39 | 39 | */ |
40 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
40 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @var string Error message |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @deprecated |
50 | 50 | * @see name |
51 | 51 | */ |
52 | - public $nom='Saphir'; |
|
52 | + public $nom = 'Saphir'; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @var string name |
56 | 56 | */ |
57 | - public $name='Saphir'; |
|
57 | + public $name = 'Saphir'; |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -71,28 +71,28 @@ discard block |
||
71 | 71 | $form = new Form($this->db); |
72 | 72 | |
73 | 73 | $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
74 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
75 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
76 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
77 | - $texte.= '<input type="hidden" name="maskconstorder" value="COMMANDE_SAPHIR_MASK">'; |
|
78 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
79 | - |
|
80 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order")); |
|
81 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
82 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
83 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order")); |
|
84 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
74 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
75 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
76 | + $texte .= '<input type="hidden" name="action" value="updateMask">'; |
|
77 | + $texte .= '<input type="hidden" name="maskconstorder" value="COMMANDE_SAPHIR_MASK">'; |
|
78 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
79 | + |
|
80 | + $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Order"), $langs->transnoentities("Order")); |
|
81 | + $tooltip .= $langs->trans("GenericMaskCodes2"); |
|
82 | + $tooltip .= $langs->trans("GenericMaskCodes3"); |
|
83 | + $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Order"), $langs->transnoentities("Order")); |
|
84 | + $tooltip .= $langs->trans("GenericMaskCodes5"); |
|
85 | 85 | |
86 | 86 | // Parametrage du prefix |
87 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
88 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskorder" value="'.$conf->global->COMMANDE_SAPHIR_MASK.'">',$tooltip,1,1).'</td>'; |
|
87 | + $texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
88 | + $texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskorder" value="'.$conf->global->COMMANDE_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>'; |
|
89 | 89 | |
90 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
90 | + $texte .= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
91 | 91 | |
92 | - $texte.= '</tr>'; |
|
92 | + $texte .= '</tr>'; |
|
93 | 93 | |
94 | - $texte.= '</table>'; |
|
95 | - $texte.= '</form>'; |
|
94 | + $texte .= '</table>'; |
|
95 | + $texte .= '</form>'; |
|
96 | 96 | |
97 | 97 | return $texte; |
98 | 98 | } |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function getExample() |
106 | 106 | { |
107 | - global $conf,$langs,$mysoc; |
|
107 | + global $conf, $langs, $mysoc; |
|
108 | 108 | |
109 | - $old_code_client=$mysoc->code_client; |
|
110 | - $old_code_type=$mysoc->typent_code; |
|
111 | - $mysoc->code_client='CCCCCCCCCC'; |
|
112 | - $mysoc->typent_code='TTTTTTTTTT'; |
|
113 | - $numExample = $this->getNextValue($mysoc,''); |
|
114 | - $mysoc->code_client=$old_code_client; |
|
115 | - $mysoc->typent_code=$old_code_type; |
|
109 | + $old_code_client = $mysoc->code_client; |
|
110 | + $old_code_type = $mysoc->typent_code; |
|
111 | + $mysoc->code_client = 'CCCCCCCCCC'; |
|
112 | + $mysoc->typent_code = 'TTTTTTTTTT'; |
|
113 | + $numExample = $this->getNextValue($mysoc, ''); |
|
114 | + $mysoc->code_client = $old_code_client; |
|
115 | + $mysoc->typent_code = $old_code_type; |
|
116 | 116 | |
117 | - if (! $numExample) |
|
117 | + if (!$numExample) |
|
118 | 118 | { |
119 | 119 | $numExample = $langs->trans('NotConfigured'); |
120 | 120 | } |
@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | * @param Object $object Object we need next value for |
129 | 129 | * @return string Value if KO, <0 if KO |
130 | 130 | */ |
131 | - function getNextValue($objsoc,$object) |
|
131 | + function getNextValue($objsoc, $object) |
|
132 | 132 | { |
133 | - global $db,$conf; |
|
133 | + global $db, $conf; |
|
134 | 134 | |
135 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
135 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
136 | 136 | |
137 | 137 | // We get cursor rule |
138 | - $mask=$conf->global->COMMANDE_SAPHIR_MASK; |
|
138 | + $mask = $conf->global->COMMANDE_SAPHIR_MASK; |
|
139 | 139 | |
140 | - if (! $mask) |
|
140 | + if (!$mask) |
|
141 | 141 | { |
142 | - $this->error='NotConfigured'; |
|
142 | + $this->error = 'NotConfigured'; |
|
143 | 143 | return 0; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $date = ($object->date_commande ? $object->date_commande : $object->date); |
147 | 147 | |
148 | - $numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc,$date); |
|
148 | + $numFinal = get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date); |
|
149 | 149 | |
150 | 150 | return $numFinal; |
151 | 151 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @param string $objforref Object for number to search |
160 | 160 | * @return string Next free value |
161 | 161 | */ |
162 | - function commande_get_num($objsoc,$objforref) |
|
162 | + function commande_get_num($objsoc, $objforref) |
|
163 | 163 | { |
164 | 164 | // phpcs:enable |
165 | - return $this->getNextValue($objsoc,$objforref); |
|
165 | + return $this->getNextValue($objsoc, $objforref); |
|
166 | 166 | } |
167 | 167 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup commande |
23 | 23 | * \brief File of class to manage customer order numbering rules Marbre |
24 | 24 | */ |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/commande/modules_commande.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Class to manage customer order numbering rules Marbre |
@@ -33,26 +33,26 @@ discard block |
||
33 | 33 | * Dolibarr version of the loaded document |
34 | 34 | * @public string |
35 | 35 | */ |
36 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
36 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
37 | 37 | |
38 | - public $prefix='CO'; |
|
38 | + public $prefix = 'CO'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var string Error code (or message) |
42 | 42 | */ |
43 | - public $error=''; |
|
43 | + public $error = ''; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var string |
47 | 47 | * @deprecated |
48 | 48 | * @see name |
49 | 49 | */ |
50 | - public $nom='Marbre'; |
|
50 | + public $nom = 'Marbre'; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @var string name |
54 | 54 | */ |
55 | - public $name='Marbre'; |
|
55 | + public $name = 'Marbre'; |
|
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | function info() |
64 | 64 | { |
65 | 65 | global $langs; |
66 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
66 | + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -86,26 +86,26 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function canBeActivated() |
88 | 88 | { |
89 | - global $conf,$langs,$db; |
|
89 | + global $conf, $langs, $db; |
|
90 | 90 | |
91 | - $coyymm=''; $max=''; |
|
91 | + $coyymm = ''; $max = ''; |
|
92 | 92 | |
93 | - $posindice=8; |
|
93 | + $posindice = 8; |
|
94 | 94 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
95 | - $sql.= " FROM ".MAIN_DB_PREFIX."commande"; |
|
96 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
97 | - $sql.= " AND entity = ".$conf->entity; |
|
95 | + $sql .= " FROM ".MAIN_DB_PREFIX."commande"; |
|
96 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
97 | + $sql .= " AND entity = ".$conf->entity; |
|
98 | 98 | |
99 | - $resql=$db->query($sql); |
|
99 | + $resql = $db->query($sql); |
|
100 | 100 | if ($resql) |
101 | 101 | { |
102 | 102 | $row = $db->fetch_row($resql); |
103 | - if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; } |
|
103 | + if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; } |
|
104 | 104 | } |
105 | - if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm)) |
|
105 | + if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) |
|
106 | 106 | { |
107 | 107 | $langs->load("errors"); |
108 | - $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
108 | + $this->error = $langs->trans('ErrorNumRefModel', $max); |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | |
@@ -119,23 +119,23 @@ discard block |
||
119 | 119 | * @param Object $object Object we need next value for |
120 | 120 | * @return string Value if KO, <0 if KO |
121 | 121 | */ |
122 | - function getNextValue($objsoc,$object) |
|
122 | + function getNextValue($objsoc, $object) |
|
123 | 123 | { |
124 | - global $db,$conf; |
|
124 | + global $db, $conf; |
|
125 | 125 | |
126 | 126 | // D'abord on recupere la valeur max |
127 | - $posindice=8; |
|
127 | + $posindice = 8; |
|
128 | 128 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
129 | - $sql.= " FROM ".MAIN_DB_PREFIX."commande"; |
|
130 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
131 | - $sql.= " AND entity = ".$conf->entity; |
|
129 | + $sql .= " FROM ".MAIN_DB_PREFIX."commande"; |
|
130 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
131 | + $sql .= " AND entity = ".$conf->entity; |
|
132 | 132 | |
133 | - $resql=$db->query($sql); |
|
133 | + $resql = $db->query($sql); |
|
134 | 134 | if ($resql) |
135 | 135 | { |
136 | 136 | $obj = $db->fetch_object($resql); |
137 | 137 | if ($obj) $max = intval($obj->max); |
138 | - else $max=0; |
|
138 | + else $max = 0; |
|
139 | 139 | } |
140 | 140 | else |
141 | 141 | { |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | //$date=time(); |
147 | - $date=$object->date; |
|
148 | - $yymm = strftime("%y%m",$date); |
|
147 | + $date = $object->date; |
|
148 | + $yymm = strftime("%y%m", $date); |
|
149 | 149 | |
150 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
151 | - else $num = sprintf("%04s", $max+1); |
|
150 | + if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
151 | + else $num = sprintf("%04s", $max + 1); |
|
152 | 152 | |
153 | 153 | dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num); |
154 | 154 | return $this->prefix.$yymm."-".$num; |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | * @param string $objforref Object for number to search |
164 | 164 | * @return string Next free value |
165 | 165 | */ |
166 | - function commande_get_num($objsoc,$objforref) |
|
166 | + function commande_get_num($objsoc, $objforref) |
|
167 | 167 | { |
168 | 168 | // phpcs:enable |
169 | - return $this->getNextValue($objsoc,$objforref); |
|
169 | + return $this->getNextValue($objsoc, $objforref); |
|
170 | 170 | } |
171 | 171 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \ingroup takepos |
25 | 25 | * \brief Description and activation file for module TakePos |
26 | 26 | */ |
27 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
27 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function __construct($db) |
41 | 41 | { |
42 | - global $langs,$conf; |
|
42 | + global $langs, $conf; |
|
43 | 43 | |
44 | 44 | $this->db = $db; |
45 | 45 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); |
59 | 59 | |
60 | 60 | // Module label (no space allowed), used if translation string 'ModuleTakePosName' not found (MyModue is name of module). |
61 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
61 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
62 | 62 | // Module description, used if translation string 'ModuleTakePosDesc' not found (MyModue is name of module). |
63 | 63 | $this->description = "Point of sales module (Touch Screen POS)"; |
64 | 64 | // Used only if file README.md and README-LL.md not found. |
@@ -71,21 +71,21 @@ discard block |
||
71 | 71 | // Name of image file used for this module. |
72 | 72 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
73 | 73 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
74 | - $this->picto='list'; |
|
74 | + $this->picto = 'list'; |
|
75 | 75 | |
76 | 76 | // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
77 | 77 | // for default path (eg: /takepos/core/xxxxx) (0=disable, 1=enable) |
78 | 78 | // for specific path of parts (eg: /takepos/core/modules/barcode) |
79 | 79 | // for specific css file (eg: /takepos/css/takepos.css.php) |
80 | 80 | $this->module_parts = array( |
81 | - 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers) |
|
82 | - 'login' => 0, // Set this to 1 if module has its own login method file (core/login) |
|
83 | - 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) |
|
84 | - 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) |
|
85 | - 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) |
|
86 | - 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) |
|
87 | - 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) |
|
88 | - 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) |
|
81 | + 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers) |
|
82 | + 'login' => 0, // Set this to 1 if module has its own login method file (core/login) |
|
83 | + 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) |
|
84 | + 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) |
|
85 | + 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) |
|
86 | + 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) |
|
87 | + 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) |
|
88 | + 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) |
|
89 | 89 | 'hooks' => array('data'=>array('invoicecard'), 'entity'=>'0') // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' |
90 | 90 | ); |
91 | 91 | |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | $this->config_page_url = array("setup.php@takepos"); |
98 | 98 | |
99 | 99 | // Dependencies |
100 | - $this->hidden = false; // A condition to hide module |
|
101 | - $this->depends = array('always1'=>"modBanque", 'always2'=>"modFacture", 'always3'=>"modProduct", 'always4'=>'modCategorie', 'FR1'=>'modBlockedLog'); // List of module class names as string that must be enabled if this module is enabled |
|
102 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
103 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
100 | + $this->hidden = false; // A condition to hide module |
|
101 | + $this->depends = array('always1'=>"modBanque", 'always2'=>"modFacture", 'always3'=>"modProduct", 'always4'=>'modCategorie', 'FR1'=>'modBlockedLog'); // List of module class names as string that must be enabled if this module is enabled |
|
102 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
103 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
104 | 104 | $this->langfiles = array("cashdesk"); |
105 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
106 | - $this->need_dolibarr_version = array(4,0); // Minimum version of Dolibarr required by module |
|
107 | - $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') |
|
108 | - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
105 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
106 | + $this->need_dolibarr_version = array(4, 0); // Minimum version of Dolibarr required by module |
|
107 | + $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') |
|
108 | + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
109 | 109 | //$this->automatic_activation = array('FR'=>'TakePosWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
110 | 110 | //$this->always_enabled = true; // If true, can't be disabled |
111 | 111 | |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | ); |
120 | 120 | |
121 | 121 | |
122 | - if (! isset($conf->takepos) || ! isset($conf->takepos->enabled)) |
|
122 | + if (!isset($conf->takepos) || !isset($conf->takepos->enabled)) |
|
123 | 123 | { |
124 | - $conf->takepos=new stdClass(); |
|
125 | - $conf->takepos->enabled=0; |
|
124 | + $conf->takepos = new stdClass(); |
|
125 | + $conf->takepos->enabled = 0; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | |
158 | 158 | // Dictionaries |
159 | - $this->dictionaries=array(); |
|
159 | + $this->dictionaries = array(); |
|
160 | 160 | /* Example: |
161 | 161 | $this->dictionaries=array( |
162 | 162 | 'langs'=>'mylangfile@takepos', |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | |
194 | 194 | |
195 | 195 | // Permissions |
196 | - $this->rights = array(); // Permission array used by this module |
|
196 | + $this->rights = array(); // Permission array used by this module |
|
197 | 197 | |
198 | - $r=0; |
|
198 | + $r = 0; |
|
199 | 199 | |
200 | 200 | $r++; |
201 | 201 | $this->rights[$r][0] = 50151; |
@@ -206,24 +206,24 @@ discard block |
||
206 | 206 | |
207 | 207 | |
208 | 208 | // Main menu entries |
209 | - $this->menu = array(); // List of menus to add |
|
210 | - $r=0; |
|
209 | + $this->menu = array(); // List of menus to add |
|
210 | + $r = 0; |
|
211 | 211 | |
212 | 212 | // Add here entries to declare new menus |
213 | 213 | |
214 | 214 | /* BEGIN MODULEBUILDER TOPMENU */ |
215 | - $this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
216 | - 'type'=>'top', // This is a Top menu entry |
|
215 | + $this->menu[$r++] = array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
216 | + 'type'=>'top', // This is a Top menu entry |
|
217 | 217 | 'titre'=>'PointOfSaleShort', |
218 | 218 | 'mainmenu'=>'takepos', |
219 | 219 | 'leftmenu'=>'', |
220 | 220 | 'url'=>'/takepos/takepos.php', |
221 | - 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
222 | - 'position'=>1000+$r, |
|
223 | - 'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled. |
|
224 | - 'perms'=>'1', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules |
|
221 | + 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
222 | + 'position'=>1000 + $r, |
|
223 | + 'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled. |
|
224 | + 'perms'=>'1', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules |
|
225 | 225 | 'target'=>'takepos', |
226 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
226 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
227 | 227 | |
228 | 228 | /* END MODULEBUILDER TOPMENU */ |
229 | 229 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | |
258 | 258 | // Exports |
259 | - $r=1; |
|
259 | + $r = 1; |
|
260 | 260 | |
261 | 261 | /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ |
262 | 262 | /* |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param string $options Options when enabling module ('', 'noboxes') |
286 | 286 | * @return int 1 if OK, 0 if KO |
287 | 287 | */ |
288 | - public function init($options='') |
|
288 | + public function init($options = '') |
|
289 | 289 | { |
290 | 290 | $this->_load_tables('/takepos/sql/'); |
291 | 291 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function __construct($db) |
120 | 120 | { |
121 | - global $conf,$langs,$mysoc; |
|
121 | + global $conf, $langs, $mysoc; |
|
122 | 122 | |
123 | 123 | // Translations |
124 | 124 | $langs->loadLangs(array("main", "projects", "companies")); |
@@ -129,38 +129,38 @@ discard block |
||
129 | 129 | |
130 | 130 | // Dimension page pour format A4 |
131 | 131 | $this->type = 'pdf'; |
132 | - $formatarray=pdf_getFormat(); |
|
132 | + $formatarray = pdf_getFormat(); |
|
133 | 133 | $this->page_largeur = $formatarray['width']; |
134 | 134 | $this->page_hauteur = $formatarray['height']; |
135 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
136 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
137 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
138 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
139 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
135 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
136 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
137 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
138 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
139 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
140 | 140 | |
141 | - $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
|
142 | - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
143 | - $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
141 | + $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
|
142 | + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
143 | + $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
144 | 144 | |
145 | 145 | // Recupere emmetteur |
146 | - $this->emetteur=$mysoc; |
|
147 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
146 | + $this->emetteur = $mysoc; |
|
147 | + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
148 | 148 | |
149 | 149 | // Defini position des colonnes |
150 | - $this->posxref=$this->marge_gauche+1; |
|
151 | - $this->posxlabel=$this->marge_gauche+25; |
|
152 | - $this->posxworkload=$this->marge_gauche+120; |
|
153 | - $this->posxprogress=$this->marge_gauche+140; |
|
154 | - $this->posxdatestart=$this->marge_gauche+152; |
|
155 | - $this->posxdateend=$this->marge_gauche+170; |
|
150 | + $this->posxref = $this->marge_gauche + 1; |
|
151 | + $this->posxlabel = $this->marge_gauche + 25; |
|
152 | + $this->posxworkload = $this->marge_gauche + 120; |
|
153 | + $this->posxprogress = $this->marge_gauche + 140; |
|
154 | + $this->posxdatestart = $this->marge_gauche + 152; |
|
155 | + $this->posxdateend = $this->marge_gauche + 170; |
|
156 | 156 | if ($this->page_largeur < 210) // To work with US executive format |
157 | 157 | { |
158 | - $this->posxref-=20; |
|
159 | - $this->posxlabel-=20; |
|
160 | - $this->posxworkload-=20; |
|
161 | - $this->posxprogress-=20; |
|
162 | - $this->posxdatestart-=20; |
|
163 | - $this->posxdateend-=20; |
|
158 | + $this->posxref -= 20; |
|
159 | + $this->posxlabel -= 20; |
|
160 | + $this->posxworkload -= 20; |
|
161 | + $this->posxprogress -= 20; |
|
162 | + $this->posxdatestart -= 20; |
|
163 | + $this->posxdateend -= 20; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | * @param Translate $outputlangs Lang output object |
174 | 174 | * @return int 1 if OK, <=0 if KO |
175 | 175 | */ |
176 | - function write_file($object,$outputlangs) |
|
176 | + function write_file($object, $outputlangs) |
|
177 | 177 | { |
178 | 178 | // phpcs:enable |
179 | 179 | global $conf, $hookmanager, $langs, $user; |
180 | 180 | |
181 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
181 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
182 | 182 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
183 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
183 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
184 | 184 | |
185 | 185 | // Load traductions files requiredby by page |
186 | 186 | $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | |
192 | 192 | $objectref = dol_sanitizeFileName($object->ref); |
193 | 193 | $dir = $conf->projet->dir_output; |
194 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
195 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
194 | + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; |
|
195 | + $file = $dir."/".$objectref.".pdf"; |
|
196 | 196 | |
197 | - if (! file_exists($dir)) |
|
197 | + if (!file_exists($dir)) |
|
198 | 198 | { |
199 | 199 | if (dol_mkdir($dir) < 0) |
200 | 200 | { |
201 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
201 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
202 | 202 | return 0; |
203 | 203 | } |
204 | 204 | } |
@@ -206,25 +206,25 @@ discard block |
||
206 | 206 | if (file_exists($dir)) |
207 | 207 | { |
208 | 208 | // Add pdfgeneration hook |
209 | - if (! is_object($hookmanager)) |
|
209 | + if (!is_object($hookmanager)) |
|
210 | 210 | { |
211 | 211 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
212 | - $hookmanager=new HookManager($this->db); |
|
212 | + $hookmanager = new HookManager($this->db); |
|
213 | 213 | } |
214 | 214 | $hookmanager->initHooks(array('pdfgeneration')); |
215 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
215 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
216 | 216 | global $action; |
217 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
217 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
218 | 218 | |
219 | 219 | // Create pdf instance |
220 | - $pdf=pdf_getInstance($this->format); |
|
221 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
222 | - $pdf->SetAutoPageBreak(1,0); |
|
220 | + $pdf = pdf_getInstance($this->format); |
|
221 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
222 | + $pdf->SetAutoPageBreak(1, 0); |
|
223 | 223 | |
224 | - $heightforinfotot = 40; // Height reserved to output the info and total part |
|
225 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
226 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
227 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
224 | + $heightforinfotot = 40; // Height reserved to output the info and total part |
|
225 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
226 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
227 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
228 | 228 | |
229 | 229 | if (class_exists('TCPDF')) |
230 | 230 | { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
235 | 235 | // Set path to the background PDF File |
236 | - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
236 | + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
237 | 237 | { |
238 | 238 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
239 | 239 | $tplidx = $pdf->importPage(1); |
@@ -241,68 +241,68 @@ discard block |
||
241 | 241 | |
242 | 242 | // Complete object by loading several other informations |
243 | 243 | $task = new Task($this->db); |
244 | - $tasksarray = $task->getTasksArray(0,0,$object->id); |
|
244 | + $tasksarray = $task->getTasksArray(0, 0, $object->id); |
|
245 | 245 | |
246 | - if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines |
|
246 | + if (!$object->id > 0) // Special case when used with object = specimen, we may return all lines |
|
247 | 247 | { |
248 | - $tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray))); |
|
248 | + $tasksarray = array_slice($tasksarray, 0, min(5, count($tasksarray))); |
|
249 | 249 | } |
250 | 250 | |
251 | - $object->lines=$tasksarray; |
|
252 | - $nblignes=count($object->lines); |
|
251 | + $object->lines = $tasksarray; |
|
252 | + $nblignes = count($object->lines); |
|
253 | 253 | |
254 | 254 | $pdf->Open(); |
255 | - $pagenb=0; |
|
256 | - $pdf->SetDrawColor(128,128,128); |
|
255 | + $pagenb = 0; |
|
256 | + $pdf->SetDrawColor(128, 128, 128); |
|
257 | 257 | |
258 | 258 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
259 | 259 | $pdf->SetSubject($outputlangs->transnoentities("Project")); |
260 | 260 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
261 | 261 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
262 | 262 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); |
263 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
263 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
264 | 264 | |
265 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
265 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
266 | 266 | |
267 | 267 | // New page |
268 | 268 | $pdf->AddPage(); |
269 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
269 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
270 | 270 | $pagenb++; |
271 | 271 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
272 | - $pdf->SetFont('','', $default_font_size - 1); |
|
273 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
274 | - $pdf->SetTextColor(0,0,0); |
|
272 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
273 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
274 | + $pdf->SetTextColor(0, 0, 0); |
|
275 | 275 | |
276 | 276 | $tab_top = 50; |
277 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
277 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
278 | 278 | $tab_height = 170; |
279 | 279 | $tab_height_newpage = 190; |
280 | 280 | |
281 | 281 | // Show public note |
282 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
282 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
283 | 283 | if ($notetoshow) |
284 | 284 | { |
285 | - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); |
|
285 | + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); |
|
286 | 286 | complete_substitutions_array($substitutionarray, $outputlangs, $object); |
287 | 287 | $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); |
288 | 288 | |
289 | 289 | $tab_top -= 2; |
290 | 290 | |
291 | - $pdf->SetFont('','', $default_font_size - 1); |
|
292 | - $pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
291 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
292 | + $pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
293 | 293 | $nexY = $pdf->GetY(); |
294 | - $height_note=$nexY-$tab_top; |
|
294 | + $height_note = $nexY - $tab_top; |
|
295 | 295 | |
296 | 296 | // Rect prend une longueur en 3eme param |
297 | - $pdf->SetDrawColor(192,192,192); |
|
298 | - $pdf->Rect($this->marge_gauche, $tab_top-2, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+2); |
|
297 | + $pdf->SetDrawColor(192, 192, 192); |
|
298 | + $pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2); |
|
299 | 299 | |
300 | 300 | $tab_height = $tab_height - $height_note; |
301 | - $tab_top = $nexY+6; |
|
301 | + $tab_top = $nexY + 6; |
|
302 | 302 | } |
303 | 303 | else |
304 | 304 | { |
305 | - $height_note=0; |
|
305 | + $height_note = 0; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | $heightoftitleline = 10; |
@@ -311,81 +311,81 @@ discard block |
||
311 | 311 | $nexY = $tab_top + $heightoftitleline + 1; |
312 | 312 | |
313 | 313 | // Loop on each lines |
314 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
314 | + for ($i = 0; $i < $nblignes; $i++) |
|
315 | 315 | { |
316 | 316 | $curY = $nexY; |
317 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
318 | - $pdf->SetTextColor(0,0,0); |
|
317 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
318 | + $pdf->SetTextColor(0, 0, 0); |
|
319 | 319 | |
320 | 320 | $pdf->setTopMargin($tab_top_newpage); |
321 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
322 | - $pageposbefore=$pdf->getPage(); |
|
321 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
322 | + $pageposbefore = $pdf->getPage(); |
|
323 | 323 | |
324 | 324 | // Description of line |
325 | - $ref=$object->lines[$i]->ref; |
|
326 | - $libelleline=$object->lines[$i]->label; |
|
327 | - $progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':''); |
|
328 | - $datestart=dol_print_date($object->lines[$i]->date_start,'day'); |
|
329 | - $dateend=dol_print_date($object->lines[$i]->date_end,'day'); |
|
330 | - $planned_workload=convertSecondToTime((int) $object->lines[$i]->planned_workload,'allhourmin'); |
|
325 | + $ref = $object->lines[$i]->ref; |
|
326 | + $libelleline = $object->lines[$i]->label; |
|
327 | + $progress = ($object->lines[$i]->progress ? $object->lines[$i]->progress.'%' : ''); |
|
328 | + $datestart = dol_print_date($object->lines[$i]->date_start, 'day'); |
|
329 | + $dateend = dol_print_date($object->lines[$i]->date_end, 'day'); |
|
330 | + $planned_workload = convertSecondToTime((int) $object->lines[$i]->planned_workload, 'allhourmin'); |
|
331 | 331 | |
332 | - $showpricebeforepagebreak=1; |
|
332 | + $showpricebeforepagebreak = 1; |
|
333 | 333 | |
334 | 334 | $pdf->startTransaction(); |
335 | 335 | // Label |
336 | 336 | $pdf->SetXY($this->posxlabel, $curY); |
337 | - $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
338 | - $pageposafter=$pdf->getPage(); |
|
337 | + $pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
338 | + $pageposafter = $pdf->getPage(); |
|
339 | 339 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
340 | 340 | { |
341 | 341 | $pdf->rollbackTransaction(true); |
342 | - $pageposafter=$pageposbefore; |
|
342 | + $pageposafter = $pageposbefore; |
|
343 | 343 | //print $pageposafter.'-'.$pageposbefore;exit; |
344 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
344 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
345 | 345 | // Label |
346 | 346 | $pdf->SetXY($this->posxlabel, $curY); |
347 | - $posybefore=$pdf->GetY(); |
|
348 | - $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
349 | - $pageposafter=$pdf->getPage(); |
|
350 | - $posyafter=$pdf->GetY(); |
|
351 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
347 | + $posybefore = $pdf->GetY(); |
|
348 | + $pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
349 | + $pageposafter = $pdf->getPage(); |
|
350 | + $posyafter = $pdf->GetY(); |
|
351 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
352 | 352 | { |
353 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
353 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
354 | 354 | { |
355 | - $pdf->AddPage('','',true); |
|
356 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
355 | + $pdf->AddPage('', '', true); |
|
356 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
357 | 357 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
358 | - $pdf->setPage($pageposafter+1); |
|
358 | + $pdf->setPage($pageposafter + 1); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | else |
362 | 362 | { |
363 | 363 | // We found a page break |
364 | - $showpricebeforepagebreak=0; |
|
365 | - $forcedesconsamepage=1; |
|
364 | + $showpricebeforepagebreak = 0; |
|
365 | + $forcedesconsamepage = 1; |
|
366 | 366 | if ($forcedesconsamepage) |
367 | 367 | { |
368 | 368 | $pdf->rollbackTransaction(true); |
369 | - $pageposafter=$pageposbefore; |
|
370 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
369 | + $pageposafter = $pageposbefore; |
|
370 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
371 | 371 | |
372 | - $pdf->AddPage('','',true); |
|
373 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
372 | + $pdf->AddPage('', '', true); |
|
373 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
374 | 374 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
375 | - $pdf->setPage($pageposafter+1); |
|
376 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
377 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
378 | - $pdf->SetTextColor(0,0,0); |
|
375 | + $pdf->setPage($pageposafter + 1); |
|
376 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
377 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
378 | + $pdf->SetTextColor(0, 0, 0); |
|
379 | 379 | |
380 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
380 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
381 | 381 | $curY = $tab_top_newpage + $heightoftitleline + 1; |
382 | 382 | |
383 | 383 | // Label |
384 | 384 | $pdf->SetXY($this->posxlabel, $curY); |
385 | - $posybefore=$pdf->GetY(); |
|
386 | - $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
387 | - $pageposafter=$pdf->getPage(); |
|
388 | - $posyafter=$pdf->GetY(); |
|
385 | + $posybefore = $pdf->GetY(); |
|
386 | + $pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
387 | + $pageposafter = $pdf->getPage(); |
|
388 | + $posyafter = $pdf->GetY(); |
|
389 | 389 | } |
390 | 390 | } |
391 | 391 | //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); |
@@ -394,13 +394,13 @@ discard block |
||
394 | 394 | { |
395 | 395 | $pdf->commitTransaction(); |
396 | 396 | } |
397 | - $posYAfterDescription=$pdf->GetY(); |
|
397 | + $posYAfterDescription = $pdf->GetY(); |
|
398 | 398 | |
399 | 399 | $nexY = $pdf->GetY(); |
400 | - $pageposafter=$pdf->getPage(); |
|
400 | + $pageposafter = $pdf->getPage(); |
|
401 | 401 | $pdf->setPage($pageposbefore); |
402 | 402 | $pdf->setTopMargin($this->marge_haute); |
403 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
403 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
404 | 404 | |
405 | 405 | // We suppose that a too long description is moved completely on next page |
406 | 406 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -408,34 +408,34 @@ discard block |
||
408 | 408 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; |
409 | 409 | } |
410 | 410 | |
411 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
411 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
412 | 412 | |
413 | 413 | // Ref of task |
414 | 414 | $pdf->SetXY($this->posxref, $curY); |
415 | - $pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); |
|
415 | + $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); |
|
416 | 416 | // Workload |
417 | 417 | $pdf->SetXY($this->posxworkload, $curY); |
418 | - $pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload?$planned_workload:'', 0, 'R'); |
|
418 | + $pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $planned_workload ? $planned_workload : '', 0, 'R'); |
|
419 | 419 | // Progress |
420 | 420 | $pdf->SetXY($this->posxprogress, $curY); |
421 | - $pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R'); |
|
421 | + $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, $progress, 0, 'R'); |
|
422 | 422 | // Date |
423 | 423 | $pdf->SetXY($this->posxdatestart, $curY); |
424 | - $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C'); |
|
424 | + $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C'); |
|
425 | 425 | $pdf->SetXY($this->posxdateend, $curY); |
426 | - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C'); |
|
426 | + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $dateend, 0, 'C'); |
|
427 | 427 | |
428 | 428 | // Add line |
429 | - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
429 | + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
430 | 430 | { |
431 | 431 | $pdf->setPage($pageposafter); |
432 | - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); |
|
432 | + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); |
|
433 | 433 | //$pdf->SetDrawColor(190,190,200); |
434 | - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); |
|
434 | + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); |
|
435 | 435 | $pdf->SetLineStyle(array('dash'=>0)); |
436 | 436 | } |
437 | 437 | |
438 | - $nexY+=2; // Passe espace entre les lignes |
|
438 | + $nexY += 2; // Passe espace entre les lignes |
|
439 | 439 | |
440 | 440 | // Detect if some page were added automatically and output _tableau for past pages |
441 | 441 | while ($pagenb < $pageposafter) |
@@ -449,13 +449,13 @@ discard block |
||
449 | 449 | { |
450 | 450 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
451 | 451 | } |
452 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
452 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
453 | 453 | $pagenb++; |
454 | 454 | $pdf->setPage($pagenb); |
455 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
455 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
456 | 456 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
457 | 457 | } |
458 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
458 | + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) |
|
459 | 459 | { |
460 | 460 | if ($pagenb == 1) |
461 | 461 | { |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | { |
466 | 466 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
467 | 467 | } |
468 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
468 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
469 | 469 | // New page |
470 | 470 | $pdf->AddPage(); |
471 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
471 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
472 | 472 | $pagenb++; |
473 | 473 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
474 | 474 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
480 | 480 | else |
481 | 481 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
482 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
482 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
483 | 483 | |
484 | 484 | // Pied de page |
485 | 485 | $this->_pagefoot($pdf, $object, $outputlangs); |
@@ -491,26 +491,26 @@ discard block |
||
491 | 491 | |
492 | 492 | // Add pdfgeneration hook |
493 | 493 | $hookmanager->initHooks(array('pdfgeneration')); |
494 | - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
494 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
495 | 495 | global $action; |
496 | - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
496 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
497 | 497 | |
498 | - if (! empty($conf->global->MAIN_UMASK)) |
|
498 | + if (!empty($conf->global->MAIN_UMASK)) |
|
499 | 499 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
500 | 500 | |
501 | 501 | $this->result = array('fullpath'=>$file); |
502 | 502 | |
503 | - return 1; // Pas d'erreur |
|
503 | + return 1; // Pas d'erreur |
|
504 | 504 | } |
505 | 505 | else |
506 | 506 | { |
507 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
507 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
508 | 508 | return 0; |
509 | 509 | } |
510 | 510 | } |
511 | 511 | else |
512 | 512 | { |
513 | - $this->error=$langs->transnoentities("ErrorConstantNotDefined","PROJECT_OUTPUTDIR"); |
|
513 | + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "PROJECT_OUTPUTDIR"); |
|
514 | 514 | return 0; |
515 | 515 | } |
516 | 516 | } |
@@ -528,41 +528,41 @@ discard block |
||
528 | 528 | * @param int $hidebottom Hide bottom bar of array |
529 | 529 | * @return void |
530 | 530 | */ |
531 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
531 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
532 | 532 | { |
533 | - global $conf,$mysoc; |
|
533 | + global $conf, $mysoc; |
|
534 | 534 | |
535 | 535 | $heightoftitleline = 10; |
536 | 536 | |
537 | 537 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
538 | 538 | |
539 | - $pdf->SetDrawColor(128,128,128); |
|
539 | + $pdf->SetDrawColor(128, 128, 128); |
|
540 | 540 | |
541 | 541 | // Draw rect of all tab (title + lines). Rect prend une longueur en 3eme param |
542 | - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); |
|
542 | + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height); |
|
543 | 543 | |
544 | 544 | // line prend une position y en 3eme param |
545 | - $pdf->line($this->marge_gauche, $tab_top+$heightoftitleline, $this->page_largeur-$this->marge_droite, $tab_top+$heightoftitleline); |
|
545 | + $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline); |
|
546 | 546 | |
547 | - $pdf->SetTextColor(0,0,0); |
|
548 | - $pdf->SetFont('','', $default_font_size); |
|
547 | + $pdf->SetTextColor(0, 0, 0); |
|
548 | + $pdf->SetFont('', '', $default_font_size); |
|
549 | 549 | |
550 | - $pdf->SetXY($this->posxref, $tab_top+1); |
|
551 | - $pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L'); |
|
550 | + $pdf->SetXY($this->posxref, $tab_top + 1); |
|
551 | + $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->transnoentities("Tasks"), '', 'L'); |
|
552 | 552 | |
553 | - $pdf->SetXY($this->posxlabel, $tab_top+1); |
|
554 | - $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); |
|
553 | + $pdf->SetXY($this->posxlabel, $tab_top + 1); |
|
554 | + $pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); |
|
555 | 555 | |
556 | - $pdf->SetXY($this->posxworkload, $tab_top+1); |
|
557 | - $pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R'); |
|
556 | + $pdf->SetXY($this->posxworkload, $tab_top + 1); |
|
557 | + $pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R'); |
|
558 | 558 | |
559 | - $pdf->SetXY($this->posxprogress, $tab_top+1); |
|
560 | - $pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R'); |
|
559 | + $pdf->SetXY($this->posxprogress, $tab_top + 1); |
|
560 | + $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R'); |
|
561 | 561 | |
562 | - $pdf->SetXY($this->posxdatestart, $tab_top+1); |
|
563 | - $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, '', 0, 'C'); |
|
562 | + $pdf->SetXY($this->posxdatestart, $tab_top + 1); |
|
563 | + $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C'); |
|
564 | 564 | |
565 | - $pdf->SetXY($this->posxdateend, $tab_top+1); |
|
565 | + $pdf->SetXY($this->posxdateend, $tab_top + 1); |
|
566 | 566 | $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); |
567 | 567 | } |
568 | 568 | |
@@ -577,62 +577,62 @@ discard block |
||
577 | 577 | */ |
578 | 578 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
579 | 579 | { |
580 | - global $langs,$conf,$mysoc; |
|
580 | + global $langs, $conf, $mysoc; |
|
581 | 581 | |
582 | 582 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
583 | 583 | |
584 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
584 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
585 | 585 | |
586 | - $pdf->SetTextColor(0,0,60); |
|
587 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
586 | + $pdf->SetTextColor(0, 0, 60); |
|
587 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
588 | 588 | |
589 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
590 | - $posy=$this->marge_haute; |
|
589 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
590 | + $posy = $this->marge_haute; |
|
591 | 591 | |
592 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
592 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
593 | 593 | |
594 | 594 | // Logo |
595 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
595 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
596 | 596 | if ($mysoc->logo) |
597 | 597 | { |
598 | 598 | if (is_readable($logo)) |
599 | 599 | { |
600 | - $height=pdf_getHeightForLogo($logo); |
|
601 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
600 | + $height = pdf_getHeightForLogo($logo); |
|
601 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
602 | 602 | } |
603 | 603 | else |
604 | 604 | { |
605 | - $pdf->SetTextColor(200,0,0); |
|
606 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
607 | - $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
605 | + $pdf->SetTextColor(200, 0, 0); |
|
606 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
607 | + $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
608 | 608 | $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); |
609 | 609 | } |
610 | 610 | } |
611 | 611 | else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); |
612 | 612 | |
613 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
614 | - $pdf->SetXY($posx,$posy); |
|
615 | - $pdf->SetTextColor(0,0,60); |
|
613 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
614 | + $pdf->SetXY($posx, $posy); |
|
615 | + $pdf->SetTextColor(0, 0, 60); |
|
616 | 616 | $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
617 | - $pdf->SetFont('','', $default_font_size + 2); |
|
617 | + $pdf->SetFont('', '', $default_font_size + 2); |
|
618 | 618 | |
619 | - $posy+=6; |
|
620 | - $pdf->SetXY($posx,$posy); |
|
621 | - $pdf->SetTextColor(0,0,60); |
|
622 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R'); |
|
619 | + $posy += 6; |
|
620 | + $pdf->SetXY($posx, $posy); |
|
621 | + $pdf->SetTextColor(0, 0, 60); |
|
622 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : ".dol_print_date($object->date_start, 'day', false, $outputlangs, true), '', 'R'); |
|
623 | 623 | |
624 | - $posy+=6; |
|
625 | - $pdf->SetXY($posx,$posy); |
|
626 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R'); |
|
624 | + $posy += 6; |
|
625 | + $pdf->SetXY($posx, $posy); |
|
626 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : ".dol_print_date($object->date_end, 'day', false, $outputlangs, true), '', 'R'); |
|
627 | 627 | |
628 | 628 | if (is_object($object->thirdparty)) |
629 | 629 | { |
630 | - $posy+=6; |
|
631 | - $pdf->SetXY($posx,$posy); |
|
632 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R'); |
|
630 | + $posy += 6; |
|
631 | + $pdf->SetXY($posx, $posy); |
|
632 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : ".$object->thirdparty->getFullName($outputlangs), '', 'R'); |
|
633 | 633 | } |
634 | 634 | |
635 | - $pdf->SetTextColor(0,0,60); |
|
635 | + $pdf->SetTextColor(0, 0, 60); |
|
636 | 636 | |
637 | 637 | // Add list of linked objects |
638 | 638 | /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc.... |
@@ -668,10 +668,10 @@ discard block |
||
668 | 668 | * @param int $hidefreetext 1=Hide free text |
669 | 669 | * @return integer |
670 | 670 | */ |
671 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
671 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
672 | 672 | { |
673 | 673 | global $conf; |
674 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
675 | - return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
674 | + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
675 | + return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
676 | 676 | } |
677 | 677 | } |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
36 | 36 | |
37 | -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
38 | -if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
39 | -if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; |
|
40 | -if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
41 | -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
42 | -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
43 | -if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
44 | -if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
45 | -if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; |
|
46 | -if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
47 | -if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
37 | +if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
38 | +if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
39 | +if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; |
|
40 | +if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
41 | +if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
42 | +if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
43 | +if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
44 | +if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
45 | +if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; |
|
46 | +if (!empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
47 | +if (!empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
48 | 48 | |
49 | 49 | |
50 | 50 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function __construct($db) |
69 | 69 | { |
70 | - global $conf,$langs,$mysoc; |
|
70 | + global $conf, $langs, $mysoc; |
|
71 | 71 | |
72 | 72 | // Translations |
73 | 73 | $langs->loadLangs(array("main", "projects", "companies")); |
@@ -78,38 +78,38 @@ discard block |
||
78 | 78 | |
79 | 79 | // Dimension page pour format A4 |
80 | 80 | $this->type = 'pdf'; |
81 | - $formatarray=pdf_getFormat(); |
|
81 | + $formatarray = pdf_getFormat(); |
|
82 | 82 | $this->page_largeur = $formatarray['width']; |
83 | 83 | $this->page_hauteur = $formatarray['height']; |
84 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
85 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
86 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
87 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
88 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
84 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
85 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
86 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
87 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
88 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
89 | 89 | |
90 | - $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
|
91 | - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
92 | - $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
90 | + $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
|
91 | + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
92 | + $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
93 | 93 | |
94 | 94 | // Recupere emmetteur |
95 | - $this->emetteur=$mysoc; |
|
96 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
95 | + $this->emetteur = $mysoc; |
|
96 | + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
97 | 97 | |
98 | 98 | // Defini position des colonnes |
99 | - $this->posxref=$this->marge_gauche+1; |
|
100 | - $this->posxdate=$this->marge_gauche+25; |
|
101 | - $this->posxsociety=$this->marge_gauche+45; |
|
102 | - $this->posxamountht=$this->marge_gauche+110; |
|
103 | - $this->posxamountttc=$this->marge_gauche+135; |
|
104 | - $this->posxstatut=$this->marge_gauche+165; |
|
99 | + $this->posxref = $this->marge_gauche + 1; |
|
100 | + $this->posxdate = $this->marge_gauche + 25; |
|
101 | + $this->posxsociety = $this->marge_gauche + 45; |
|
102 | + $this->posxamountht = $this->marge_gauche + 110; |
|
103 | + $this->posxamountttc = $this->marge_gauche + 135; |
|
104 | + $this->posxstatut = $this->marge_gauche + 165; |
|
105 | 105 | if ($this->page_largeur < 210) // To work with US executive format |
106 | 106 | { |
107 | - $this->posxref-=20; |
|
108 | - $this->posxdate-=20; |
|
109 | - $this->posxsociete-=20; |
|
110 | - $this->posxamountht-=20; |
|
111 | - $this->posxamountttc-=20; |
|
112 | - $this->posstatut-=20; |
|
107 | + $this->posxref -= 20; |
|
108 | + $this->posxdate -= 20; |
|
109 | + $this->posxsociete -= 20; |
|
110 | + $this->posxamountht -= 20; |
|
111 | + $this->posxamountttc -= 20; |
|
112 | + $this->posstatut -= 20; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param Translate $outputlangs Lang output object |
123 | 123 | * @return int 1 if OK, <=0 if KO |
124 | 124 | */ |
125 | - function write_file($object,$outputlangs) |
|
125 | + function write_file($object, $outputlangs) |
|
126 | 126 | { |
127 | 127 | // phpcs:enable |
128 | 128 | global $conf, $hookmanager, $langs, $user; |
129 | 129 | |
130 | - $formproject=new FormProjets($this->db); |
|
130 | + $formproject = new FormProjets($this->db); |
|
131 | 131 | |
132 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
132 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
133 | 133 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
134 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
134 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
135 | 135 | |
136 | 136 | // Load traductions files requiredby by page |
137 | 137 | $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | |
143 | 143 | $objectref = dol_sanitizeFileName($object->ref); |
144 | 144 | $dir = $conf->projet->dir_output; |
145 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
146 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
145 | + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; |
|
146 | + $file = $dir."/".$objectref.".pdf"; |
|
147 | 147 | |
148 | - if (! file_exists($dir)) |
|
148 | + if (!file_exists($dir)) |
|
149 | 149 | { |
150 | 150 | if (dol_mkdir($dir) < 0) |
151 | 151 | { |
152 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
152 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
153 | 153 | return 0; |
154 | 154 | } |
155 | 155 | } |
@@ -157,25 +157,25 @@ discard block |
||
157 | 157 | if (file_exists($dir)) |
158 | 158 | { |
159 | 159 | // Add pdfgeneration hook |
160 | - if (! is_object($hookmanager)) |
|
160 | + if (!is_object($hookmanager)) |
|
161 | 161 | { |
162 | 162 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
163 | - $hookmanager=new HookManager($this->db); |
|
163 | + $hookmanager = new HookManager($this->db); |
|
164 | 164 | } |
165 | 165 | $hookmanager->initHooks(array('pdfgeneration')); |
166 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
166 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
167 | 167 | global $action; |
168 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
168 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
169 | 169 | |
170 | 170 | // Create pdf instance |
171 | - $pdf=pdf_getInstance($this->format); |
|
172 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
173 | - $pdf->SetAutoPageBreak(1,0); |
|
171 | + $pdf = pdf_getInstance($this->format); |
|
172 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
173 | + $pdf->SetAutoPageBreak(1, 0); |
|
174 | 174 | |
175 | - $heightforinfotot = 40; // Height reserved to output the info and total part |
|
176 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
177 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
178 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
175 | + $heightforinfotot = 40; // Height reserved to output the info and total part |
|
176 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
177 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
178 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
179 | 179 | |
180 | 180 | if (class_exists('TCPDF')) |
181 | 181 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
186 | 186 | // Set path to the background PDF File |
187 | - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
187 | + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
188 | 188 | { |
189 | 189 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
190 | 190 | $tplidx = $pdf->importPage(1); |
@@ -196,65 +196,65 @@ discard block |
||
196 | 196 | $tasksarray = $task->getTasksArray(0, 0, $object->id); |
197 | 197 | |
198 | 198 | // Special case when used with object = specimen, we may return all lines |
199 | - if (! $object->id > 0) { |
|
200 | - $tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray))); |
|
199 | + if (!$object->id > 0) { |
|
200 | + $tasksarray = array_slice($tasksarray, 0, min(5, count($tasksarray))); |
|
201 | 201 | } |
202 | 202 | |
203 | - $object->lines=$tasksarray; |
|
204 | - $nblignes=count($object->lines); |
|
203 | + $object->lines = $tasksarray; |
|
204 | + $nblignes = count($object->lines); |
|
205 | 205 | |
206 | 206 | $pdf->Open(); |
207 | - $pagenb=0; |
|
208 | - $pdf->SetDrawColor(128,128,128); |
|
207 | + $pagenb = 0; |
|
208 | + $pdf->SetDrawColor(128, 128, 128); |
|
209 | 209 | |
210 | 210 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
211 | 211 | $pdf->SetSubject($outputlangs->transnoentities("Project")); |
212 | 212 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
213 | 213 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
214 | 214 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); |
215 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
215 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
216 | 216 | |
217 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
217 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
218 | 218 | |
219 | 219 | // New page |
220 | 220 | $pdf->AddPage(); |
221 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
221 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
222 | 222 | $pagenb++; |
223 | 223 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
224 | - $pdf->SetFont('','', $default_font_size - 1); |
|
225 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
226 | - $pdf->SetTextColor(0,0,0); |
|
224 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
225 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
226 | + $pdf->SetTextColor(0, 0, 0); |
|
227 | 227 | |
228 | 228 | $tab_top = 50; |
229 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
229 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
230 | 230 | $tab_height = 170; |
231 | 231 | $tab_height_newpage = 190; |
232 | 232 | |
233 | 233 | // Show public note |
234 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
234 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
235 | 235 | if ($notetoshow) |
236 | 236 | { |
237 | - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); |
|
237 | + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); |
|
238 | 238 | complete_substitutions_array($substitutionarray, $outputlangs, $object); |
239 | 239 | $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); |
240 | 240 | |
241 | 241 | $tab_top -= 2; |
242 | 242 | |
243 | - $pdf->SetFont('','', $default_font_size - 1); |
|
244 | - $pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
243 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
244 | + $pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
245 | 245 | $nexY = $pdf->GetY(); |
246 | - $height_note=$nexY-$tab_top; |
|
246 | + $height_note = $nexY - $tab_top; |
|
247 | 247 | |
248 | 248 | // Rect prend une longueur en 3eme param |
249 | - $pdf->SetDrawColor(192,192,192); |
|
250 | - $pdf->Rect($this->marge_gauche, $tab_top-2, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+2); |
|
249 | + $pdf->SetDrawColor(192, 192, 192); |
|
250 | + $pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2); |
|
251 | 251 | |
252 | 252 | $tab_height = $tab_height - $height_note; |
253 | - $tab_top = $nexY+6; |
|
253 | + $tab_top = $nexY + 6; |
|
254 | 254 | } |
255 | 255 | else |
256 | 256 | { |
257 | - $height_note=0; |
|
257 | + $height_note = 0; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | $heightoftitleline = 10; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $curY = $tab_top + $heightoftitleline + 1; |
263 | 263 | $nexY = $tab_top + $heightoftitleline + 1; |
264 | 264 | |
265 | - $listofreferent=array( |
|
265 | + $listofreferent = array( |
|
266 | 266 | 'propal'=>array( |
267 | 267 | 'name'=>"Proposals", |
268 | 268 | 'title'=>"ListProposalsAssociatedProject", |
@@ -364,15 +364,15 @@ discard block |
||
364 | 364 | |
365 | 365 | foreach ($listofreferent as $key => $value) |
366 | 366 | { |
367 | - $title=$value['title']; |
|
368 | - $classname=$value['class']; |
|
369 | - $tablename=$value['table']; |
|
370 | - $datefieldname=$value['datefieldname']; |
|
371 | - $qualified=$value['test']; |
|
372 | - $langstoload=$value['lang']; |
|
367 | + $title = $value['title']; |
|
368 | + $classname = $value['class']; |
|
369 | + $tablename = $value['table']; |
|
370 | + $datefieldname = $value['datefieldname']; |
|
371 | + $qualified = $value['test']; |
|
372 | + $langstoload = $value['lang']; |
|
373 | 373 | $langs->load($langstoload); |
374 | 374 | |
375 | - if (! $qualified) continue; |
|
375 | + if (!$qualified) continue; |
|
376 | 376 | |
377 | 377 | //var_dump("$key, $tablename, $datefieldname, $dates, $datee"); |
378 | 378 | $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | $nexY = $pdf->GetY() + 5; |
389 | 389 | |
390 | 390 | $curY = $nexY; |
391 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
392 | - $pdf->SetTextColor(0,0,0); |
|
391 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
392 | + $pdf->SetTextColor(0, 0, 0); |
|
393 | 393 | |
394 | 394 | $pdf->SetXY($this->posxref, $curY); |
395 | 395 | $pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L'); |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | $pdf->SetXY($this->posxdate, $curY); |
403 | 403 | $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, $outputlangs->transnoentities("Date"), 1, 'C'); |
404 | 404 | $pdf->SetXY($this->posxsociety, $curY); |
405 | - $titlethirdparty=$outputlangs->transnoentities("ThirdParty"); |
|
406 | - if ($classname == 'ExpenseReport') $titlethirdparty=$langs->trans("User"); |
|
405 | + $titlethirdparty = $outputlangs->transnoentities("ThirdParty"); |
|
406 | + if ($classname == 'ExpenseReport') $titlethirdparty = $langs->trans("User"); |
|
407 | 407 | $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $titlethirdparty, 1, 'L'); |
408 | 408 | if (empty($value['disableamount'])) { |
409 | 409 | $pdf->SetXY($this->posxamountht, $curY); |
@@ -426,22 +426,22 @@ discard block |
||
426 | 426 | $num = count($elementarray); |
427 | 427 | |
428 | 428 | // Loop on each lines |
429 | - for ($i = 0; $i < $num; $i ++) |
|
429 | + for ($i = 0; $i < $num; $i++) |
|
430 | 430 | { |
431 | 431 | $curY = $nexY; |
432 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
433 | - $pdf->SetTextColor(0,0,0); |
|
432 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
433 | + $pdf->SetTextColor(0, 0, 0); |
|
434 | 434 | |
435 | 435 | $pdf->setTopMargin($tab_top_newpage); |
436 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
437 | - $pageposbefore=$pdf->getPage(); |
|
436 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
437 | + $pageposbefore = $pdf->getPage(); |
|
438 | 438 | |
439 | 439 | // Description of line |
440 | - $idofelement=$elementarray[$i]; |
|
440 | + $idofelement = $elementarray[$i]; |
|
441 | 441 | if ($classname == 'ExpenseReport') |
442 | 442 | { |
443 | 443 | // We get id of expense report |
444 | - $expensereportline=new ExpenseReportLine($this->db); |
|
444 | + $expensereportline = new ExpenseReportLine($this->db); |
|
445 | 445 | $expensereportline->fetch($idofelement); |
446 | 446 | $idofelement = $expensereportline->fk_expensereport; |
447 | 447 | } |
@@ -457,63 +457,63 @@ discard block |
||
457 | 457 | $qualifiedfortotal = false; // Replacement invoice |
458 | 458 | } |
459 | 459 | |
460 | - $showpricebeforepagebreak=1; |
|
460 | + $showpricebeforepagebreak = 1; |
|
461 | 461 | |
462 | 462 | $pdf->startTransaction(); |
463 | 463 | // Label |
464 | 464 | $pdf->SetXY($this->posxref, $curY); |
465 | 465 | $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); |
466 | - $pageposafter=$pdf->getPage(); |
|
466 | + $pageposafter = $pdf->getPage(); |
|
467 | 467 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
468 | 468 | { |
469 | 469 | $pdf->rollbackTransaction(true); |
470 | - $pageposafter=$pageposbefore; |
|
470 | + $pageposafter = $pageposbefore; |
|
471 | 471 | //print $pageposafter.'-'.$pageposbefore;exit; |
472 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
472 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
473 | 473 | // Label |
474 | 474 | $pdf->SetXY($this->posxref, $curY); |
475 | - $posybefore=$pdf->GetY(); |
|
475 | + $posybefore = $pdf->GetY(); |
|
476 | 476 | $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); |
477 | - $pageposafter=$pdf->getPage(); |
|
478 | - $posyafter=$pdf->GetY(); |
|
479 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
477 | + $pageposafter = $pdf->getPage(); |
|
478 | + $posyafter = $pdf->GetY(); |
|
479 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
480 | 480 | { |
481 | - if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page |
|
481 | + if ($i == ($num - 1)) // No more lines, and no space left to show total, so we create a new page |
|
482 | 482 | { |
483 | - $pdf->AddPage('','',true); |
|
484 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
483 | + $pdf->AddPage('', '', true); |
|
484 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
485 | 485 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
486 | - $pdf->setPage($pageposafter+1); |
|
486 | + $pdf->setPage($pageposafter + 1); |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | else |
490 | 490 | { |
491 | 491 | // We found a page break |
492 | - $showpricebeforepagebreak=0; |
|
493 | - $forcedesconsamepage=1; |
|
492 | + $showpricebeforepagebreak = 0; |
|
493 | + $forcedesconsamepage = 1; |
|
494 | 494 | if ($forcedesconsamepage) |
495 | 495 | { |
496 | 496 | $pdf->rollbackTransaction(true); |
497 | - $pageposafter=$pageposbefore; |
|
498 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
497 | + $pageposafter = $pageposbefore; |
|
498 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
499 | 499 | |
500 | - $pdf->AddPage('','',true); |
|
501 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
500 | + $pdf->AddPage('', '', true); |
|
501 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
502 | 502 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
503 | - $pdf->setPage($pageposafter+1); |
|
504 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
505 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
506 | - $pdf->SetTextColor(0,0,0); |
|
503 | + $pdf->setPage($pageposafter + 1); |
|
504 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
505 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
506 | + $pdf->SetTextColor(0, 0, 0); |
|
507 | 507 | |
508 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
508 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
509 | 509 | $curY = $tab_top_newpage + $heightoftitleline + 1; |
510 | 510 | |
511 | 511 | // Label |
512 | 512 | $pdf->SetXY($this->posxref, $curY); |
513 | - $posybefore=$pdf->GetY(); |
|
513 | + $posybefore = $pdf->GetY(); |
|
514 | 514 | $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); |
515 | - $pageposafter=$pdf->getPage(); |
|
516 | - $posyafter=$pdf->GetY(); |
|
515 | + $pageposafter = $pdf->getPage(); |
|
516 | + $posyafter = $pdf->GetY(); |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); |
@@ -522,13 +522,13 @@ discard block |
||
522 | 522 | { |
523 | 523 | $pdf->commitTransaction(); |
524 | 524 | } |
525 | - $posYAfterDescription=$pdf->GetY(); |
|
525 | + $posYAfterDescription = $pdf->GetY(); |
|
526 | 526 | |
527 | 527 | $nexY = $pdf->GetY(); |
528 | - $pageposafter=$pdf->getPage(); |
|
528 | + $pageposafter = $pdf->getPage(); |
|
529 | 529 | $pdf->setPage($pageposbefore); |
530 | 530 | $pdf->setTopMargin($this->marge_haute); |
531 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
531 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
532 | 532 | |
533 | 533 | // We suppose that a too long description is moved completely on next page |
534 | 534 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; |
537 | 537 | } |
538 | 538 | |
539 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
539 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
540 | 540 | |
541 | 541 | // Date |
542 | 542 | if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | $pdf->SetXY($this->posxsociety, $curY); |
558 | 558 | if ($classname == 'ExpenseReport') |
559 | 559 | { |
560 | - $fuser=new User($this->db); |
|
560 | + $fuser = new User($this->db); |
|
561 | 561 | $fuser->fetch($element->fk_user_author); |
562 | 562 | $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L'); |
563 | 563 | } |
564 | 564 | else |
565 | 565 | { |
566 | - $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty)?$element->thirdparty->name:''), 1, 'L'); |
|
566 | + $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty) ? $element->thirdparty->name : ''), 1, 'L'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | // Amount without tax |
@@ -612,23 +612,23 @@ discard block |
||
612 | 612 | $pdf->SetXY($this->posxamountttc, $curY); |
613 | 613 | $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : ' '), 1, 'R'); |
614 | 614 | $pdf->SetXY($this->posxstatut, $curY); |
615 | - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L'); |
|
615 | + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb")." ".$num, 1, 'L'); |
|
616 | 616 | } |
617 | 617 | $nexY = $pdf->GetY() + 5; |
618 | 618 | $curY = $nexY; |
619 | 619 | } |
620 | 620 | } |
621 | 621 | |
622 | - $nexY+=2; // Passe espace entre les lignes |
|
622 | + $nexY += 2; // Passe espace entre les lignes |
|
623 | 623 | |
624 | 624 | // Detect if some page were added automatically and output _tableau for past pages |
625 | 625 | while ($pagenb < $pageposafter) |
626 | 626 | { |
627 | 627 | $pdf->setPage($pagenb); |
628 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
628 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
629 | 629 | $pagenb++; |
630 | 630 | $pdf->setPage($pagenb); |
631 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
631 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
632 | 632 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
633 | 633 | } |
634 | 634 | } |
@@ -643,26 +643,26 @@ discard block |
||
643 | 643 | |
644 | 644 | // Add pdfgeneration hook |
645 | 645 | $hookmanager->initHooks(array('pdfgeneration')); |
646 | - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
646 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
647 | 647 | global $action; |
648 | - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
648 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
649 | 649 | |
650 | - if (! empty($conf->global->MAIN_UMASK)) |
|
650 | + if (!empty($conf->global->MAIN_UMASK)) |
|
651 | 651 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
652 | 652 | |
653 | 653 | $this->result = array('fullpath'=>$file); |
654 | 654 | |
655 | - return 1; // Pas d'erreur |
|
655 | + return 1; // Pas d'erreur |
|
656 | 656 | } |
657 | 657 | else |
658 | 658 | { |
659 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
659 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
660 | 660 | return 0; |
661 | 661 | } |
662 | 662 | } |
663 | 663 | else |
664 | 664 | { |
665 | - $this->error=$langs->transnoentities("ErrorConstantNotDefined","PROJECT_OUTPUTDIR"); |
|
665 | + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "PROJECT_OUTPUTDIR"); |
|
666 | 666 | return 0; |
667 | 667 | } |
668 | 668 | } |
@@ -680,41 +680,41 @@ discard block |
||
680 | 680 | * @param int $hidebottom Hide bottom bar of array |
681 | 681 | * @return void |
682 | 682 | */ |
683 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
683 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
684 | 684 | { |
685 | - global $conf,$mysoc; |
|
685 | + global $conf, $mysoc; |
|
686 | 686 | |
687 | 687 | $heightoftitleline = 10; |
688 | 688 | |
689 | 689 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
690 | 690 | |
691 | - $pdf->SetDrawColor(128,128,128); |
|
691 | + $pdf->SetDrawColor(128, 128, 128); |
|
692 | 692 | |
693 | 693 | // Draw rect of all tab (title + lines). Rect prend une longueur en 3eme param |
694 | - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); |
|
694 | + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height); |
|
695 | 695 | |
696 | 696 | // line prend une position y en 3eme param |
697 | - $pdf->line($this->marge_gauche, $tab_top+$heightoftitleline, $this->page_largeur-$this->marge_droite, $tab_top+$heightoftitleline); |
|
697 | + $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline); |
|
698 | 698 | |
699 | - $pdf->SetTextColor(0,0,0); |
|
700 | - $pdf->SetFont('','', $default_font_size); |
|
699 | + $pdf->SetTextColor(0, 0, 0); |
|
700 | + $pdf->SetFont('', '', $default_font_size); |
|
701 | 701 | |
702 | - $pdf->SetXY($this->posxref, $tab_top+1); |
|
703 | - $pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L'); |
|
702 | + $pdf->SetXY($this->posxref, $tab_top + 1); |
|
703 | + $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->transnoentities("Tasks"), '', 'L'); |
|
704 | 704 | |
705 | - $pdf->SetXY($this->posxlabel, $tab_top+1); |
|
706 | - $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); |
|
705 | + $pdf->SetXY($this->posxlabel, $tab_top + 1); |
|
706 | + $pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); |
|
707 | 707 | |
708 | - $pdf->SetXY($this->posxworkload, $tab_top+1); |
|
709 | - $pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R'); |
|
708 | + $pdf->SetXY($this->posxworkload, $tab_top + 1); |
|
709 | + $pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R'); |
|
710 | 710 | |
711 | - $pdf->SetXY($this->posxprogress, $tab_top+1); |
|
712 | - $pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R'); |
|
711 | + $pdf->SetXY($this->posxprogress, $tab_top + 1); |
|
712 | + $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R'); |
|
713 | 713 | |
714 | - $pdf->SetXY($this->posxdatestart, $tab_top+1); |
|
715 | - $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, '', 0, 'C'); |
|
714 | + $pdf->SetXY($this->posxdatestart, $tab_top + 1); |
|
715 | + $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C'); |
|
716 | 716 | |
717 | - $pdf->SetXY($this->posxdateend, $tab_top+1); |
|
717 | + $pdf->SetXY($this->posxdateend, $tab_top + 1); |
|
718 | 718 | $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); |
719 | 719 | } |
720 | 720 | |
@@ -729,62 +729,62 @@ discard block |
||
729 | 729 | */ |
730 | 730 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
731 | 731 | { |
732 | - global $langs,$conf,$mysoc; |
|
732 | + global $langs, $conf, $mysoc; |
|
733 | 733 | |
734 | 734 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
735 | 735 | |
736 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
736 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
737 | 737 | |
738 | - $pdf->SetTextColor(0,0,60); |
|
739 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
738 | + $pdf->SetTextColor(0, 0, 60); |
|
739 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
740 | 740 | |
741 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
742 | - $posy=$this->marge_haute; |
|
741 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
742 | + $posy = $this->marge_haute; |
|
743 | 743 | |
744 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
744 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
745 | 745 | |
746 | 746 | // Logo |
747 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
747 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
748 | 748 | if ($mysoc->logo) |
749 | 749 | { |
750 | 750 | if (is_readable($logo)) |
751 | 751 | { |
752 | - $height=pdf_getHeightForLogo($logo); |
|
753 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
752 | + $height = pdf_getHeightForLogo($logo); |
|
753 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
754 | 754 | } |
755 | 755 | else |
756 | 756 | { |
757 | - $pdf->SetTextColor(200,0,0); |
|
758 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
759 | - $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
757 | + $pdf->SetTextColor(200, 0, 0); |
|
758 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
759 | + $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
760 | 760 | $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); |
761 | 761 | } |
762 | 762 | } |
763 | 763 | else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); |
764 | 764 | |
765 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
766 | - $pdf->SetXY($posx,$posy); |
|
767 | - $pdf->SetTextColor(0,0,60); |
|
765 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
766 | + $pdf->SetXY($posx, $posy); |
|
767 | + $pdf->SetTextColor(0, 0, 60); |
|
768 | 768 | $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
769 | - $pdf->SetFont('','', $default_font_size + 2); |
|
769 | + $pdf->SetFont('', '', $default_font_size + 2); |
|
770 | 770 | |
771 | - $posy+=6; |
|
772 | - $pdf->SetXY($posx,$posy); |
|
773 | - $pdf->SetTextColor(0,0,60); |
|
774 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R'); |
|
771 | + $posy += 6; |
|
772 | + $pdf->SetXY($posx, $posy); |
|
773 | + $pdf->SetTextColor(0, 0, 60); |
|
774 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : ".dol_print_date($object->date_start, 'day', false, $outputlangs, true), '', 'R'); |
|
775 | 775 | |
776 | - $posy+=6; |
|
777 | - $pdf->SetXY($posx,$posy); |
|
778 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R'); |
|
776 | + $posy += 6; |
|
777 | + $pdf->SetXY($posx, $posy); |
|
778 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : ".dol_print_date($object->date_end, 'day', false, $outputlangs, true), '', 'R'); |
|
779 | 779 | |
780 | 780 | if (is_object($object->thirdparty)) |
781 | 781 | { |
782 | - $posy+=6; |
|
783 | - $pdf->SetXY($posx,$posy); |
|
784 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R'); |
|
782 | + $posy += 6; |
|
783 | + $pdf->SetXY($posx, $posy); |
|
784 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : ".$object->thirdparty->getFullName($outputlangs), '', 'R'); |
|
785 | 785 | } |
786 | 786 | |
787 | - $pdf->SetTextColor(0,0,60); |
|
787 | + $pdf->SetTextColor(0, 0, 60); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
@@ -796,10 +796,10 @@ discard block |
||
796 | 796 | * @param int $hidefreetext 1=Hide free text |
797 | 797 | * @return integer |
798 | 798 | */ |
799 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
799 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
800 | 800 | { |
801 | 801 | global $conf; |
802 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
803 | - return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
802 | + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
803 | + return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
804 | 804 | } |
805 | 805 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function __construct($db) |
52 | 52 | { |
53 | - global $conf,$langs,$mysoc; |
|
53 | + global $conf, $langs, $mysoc; |
|
54 | 54 | |
55 | 55 | // Translations |
56 | 56 | $langs->loadLangs(array("main", "projects", "companies")); |
@@ -61,38 +61,38 @@ discard block |
||
61 | 61 | |
62 | 62 | // Dimension page pour format A4 |
63 | 63 | $this->type = 'pdf'; |
64 | - $formatarray=pdf_getFormat(); |
|
64 | + $formatarray = pdf_getFormat(); |
|
65 | 65 | $this->page_largeur = $formatarray['width']; |
66 | 66 | $this->page_hauteur = $formatarray['height']; |
67 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
68 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
69 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
70 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
71 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
67 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
68 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
69 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
70 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
71 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
72 | 72 | |
73 | - $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
|
74 | - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
75 | - $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
73 | + $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO |
|
74 | + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
75 | + $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
76 | 76 | |
77 | 77 | // Recupere emmetteur |
78 | - $this->emetteur=$mysoc; |
|
79 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
78 | + $this->emetteur = $mysoc; |
|
79 | + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
80 | 80 | |
81 | 81 | // Defini position des colonnes |
82 | - $this->posxref=$this->marge_gauche+1; |
|
83 | - $this->posxlabel=$this->marge_gauche+25; |
|
84 | - $this->posxtimespent=$this->marge_gauche+120; |
|
82 | + $this->posxref = $this->marge_gauche + 1; |
|
83 | + $this->posxlabel = $this->marge_gauche + 25; |
|
84 | + $this->posxtimespent = $this->marge_gauche + 120; |
|
85 | 85 | //$this->posxprogress=$this->marge_gauche+140; |
86 | - $this->posxdatestart=$this->marge_gauche+152; |
|
87 | - $this->posxdateend=$this->marge_gauche+170; |
|
86 | + $this->posxdatestart = $this->marge_gauche + 152; |
|
87 | + $this->posxdateend = $this->marge_gauche + 170; |
|
88 | 88 | if ($this->page_largeur < 210) // To work with US executive format |
89 | 89 | { |
90 | - $this->posxref-=20; |
|
91 | - $this->posxlabel-=20; |
|
92 | - $this->posxtimespent-=20; |
|
90 | + $this->posxref -= 20; |
|
91 | + $this->posxlabel -= 20; |
|
92 | + $this->posxtimespent -= 20; |
|
93 | 93 | //$this->posxprogress-=20; |
94 | - $this->posxdatestart-=20; |
|
95 | - $this->posxdateend-=20; |
|
94 | + $this->posxdatestart -= 20; |
|
95 | + $this->posxdateend -= 20; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @param Translate $outputlangs Lang output object |
106 | 106 | * @return int 1 if OK, <=0 if KO |
107 | 107 | */ |
108 | - function write_file($object,$outputlangs) |
|
108 | + function write_file($object, $outputlangs) |
|
109 | 109 | { |
110 | 110 | // phpcs:enable |
111 | 111 | global $conf, $hookmanager, $langs, $user; |
112 | 112 | |
113 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
113 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
114 | 114 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
115 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
115 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
116 | 116 | |
117 | 117 | // Load traductions files requiredby by page |
118 | 118 | $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | |
124 | 124 | $objectref = dol_sanitizeFileName($object->ref); |
125 | 125 | $dir = $conf->projet->dir_output; |
126 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
127 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
126 | + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; |
|
127 | + $file = $dir."/".$objectref.".pdf"; |
|
128 | 128 | |
129 | - if (! file_exists($dir)) |
|
129 | + if (!file_exists($dir)) |
|
130 | 130 | { |
131 | 131 | if (dol_mkdir($dir) < 0) |
132 | 132 | { |
133 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
133 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
134 | 134 | return 0; |
135 | 135 | } |
136 | 136 | } |
@@ -138,24 +138,24 @@ discard block |
||
138 | 138 | if (file_exists($dir)) |
139 | 139 | { |
140 | 140 | // Add pdfgeneration hook |
141 | - if (! is_object($hookmanager)) |
|
141 | + if (!is_object($hookmanager)) |
|
142 | 142 | { |
143 | 143 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
144 | - $hookmanager=new HookManager($this->db); |
|
144 | + $hookmanager = new HookManager($this->db); |
|
145 | 145 | } |
146 | 146 | $hookmanager->initHooks(array('pdfgeneration')); |
147 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
147 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
148 | 148 | global $action; |
149 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
149 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
150 | 150 | |
151 | 151 | // Create pdf instance |
152 | - $pdf=pdf_getInstance($this->format); |
|
153 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
154 | - $pdf->SetAutoPageBreak(1,0); |
|
152 | + $pdf = pdf_getInstance($this->format); |
|
153 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
154 | + $pdf->SetAutoPageBreak(1, 0); |
|
155 | 155 | |
156 | - $heightforinfotot = 40; // Height reserved to output the info and total part |
|
157 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
158 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
156 | + $heightforinfotot = 40; // Height reserved to output the info and total part |
|
157 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
158 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
159 | 159 | |
160 | 160 | if (class_exists('TCPDF')) |
161 | 161 | { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
166 | 166 | // Set path to the background PDF File |
167 | - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
167 | + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
168 | 168 | { |
169 | 169 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
170 | 170 | $tplidx = $pdf->importPage(1); |
@@ -172,68 +172,68 @@ discard block |
||
172 | 172 | |
173 | 173 | // Complete object by loading several other informations |
174 | 174 | $task = new Task($this->db); |
175 | - $tasksarray = $task->getTasksArray(0,0,$object->id); |
|
175 | + $tasksarray = $task->getTasksArray(0, 0, $object->id); |
|
176 | 176 | |
177 | - if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines |
|
177 | + if (!$object->id > 0) // Special case when used with object = specimen, we may return all lines |
|
178 | 178 | { |
179 | - $tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray))); |
|
179 | + $tasksarray = array_slice($tasksarray, 0, min(5, count($tasksarray))); |
|
180 | 180 | } |
181 | 181 | |
182 | - $object->lines=$tasksarray; |
|
183 | - $nblignes=count($object->lines); |
|
182 | + $object->lines = $tasksarray; |
|
183 | + $nblignes = count($object->lines); |
|
184 | 184 | |
185 | 185 | $pdf->Open(); |
186 | - $pagenb=0; |
|
187 | - $pdf->SetDrawColor(128,128,128); |
|
186 | + $pagenb = 0; |
|
187 | + $pdf->SetDrawColor(128, 128, 128); |
|
188 | 188 | |
189 | 189 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
190 | 190 | $pdf->SetSubject($outputlangs->transnoentities("Project")); |
191 | 191 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
192 | 192 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
193 | 193 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); |
194 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
194 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
195 | 195 | |
196 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
196 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
197 | 197 | |
198 | 198 | // New page |
199 | 199 | $pdf->AddPage(); |
200 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
200 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
201 | 201 | $pagenb++; |
202 | 202 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
203 | - $pdf->SetFont('','', $default_font_size - 1); |
|
204 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
205 | - $pdf->SetTextColor(0,0,0); |
|
203 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
204 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
205 | + $pdf->SetTextColor(0, 0, 0); |
|
206 | 206 | |
207 | 207 | $tab_top = 50; |
208 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
208 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
209 | 209 | $tab_height = 170; |
210 | 210 | $tab_height_newpage = 190; |
211 | 211 | |
212 | 212 | // Show public note |
213 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
213 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
214 | 214 | if ($notetoshow) |
215 | 215 | { |
216 | - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); |
|
216 | + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); |
|
217 | 217 | complete_substitutions_array($substitutionarray, $outputlangs, $object); |
218 | 218 | $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); |
219 | 219 | |
220 | 220 | $tab_top -= 2; |
221 | 221 | |
222 | - $pdf->SetFont('','', $default_font_size - 1); |
|
223 | - $pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
222 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
223 | + $pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
224 | 224 | $nexY = $pdf->GetY(); |
225 | - $height_note=$nexY-$tab_top; |
|
225 | + $height_note = $nexY - $tab_top; |
|
226 | 226 | |
227 | 227 | // Rect prend une longueur en 3eme param |
228 | - $pdf->SetDrawColor(192,192,192); |
|
229 | - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
228 | + $pdf->SetDrawColor(192, 192, 192); |
|
229 | + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); |
|
230 | 230 | |
231 | 231 | $tab_height = $tab_height - $height_note; |
232 | - $tab_top = $nexY+6; |
|
232 | + $tab_top = $nexY + 6; |
|
233 | 233 | } |
234 | 234 | else |
235 | 235 | { |
236 | - $height_note=0; |
|
236 | + $height_note = 0; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $heightoftitleline = 10; |
@@ -242,81 +242,81 @@ discard block |
||
242 | 242 | $nexY = $tab_top + $heightoftitleline + 1; |
243 | 243 | |
244 | 244 | // Loop on each lines |
245 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
245 | + for ($i = 0; $i < $nblignes; $i++) |
|
246 | 246 | { |
247 | 247 | $curY = $nexY; |
248 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
249 | - $pdf->SetTextColor(0,0,0); |
|
248 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
249 | + $pdf->SetTextColor(0, 0, 0); |
|
250 | 250 | |
251 | 251 | $pdf->setTopMargin($tab_top_newpage); |
252 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
253 | - $pageposbefore=$pdf->getPage(); |
|
252 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
253 | + $pageposbefore = $pdf->getPage(); |
|
254 | 254 | |
255 | 255 | // Description of line |
256 | - $ref=$object->lines[$i]->ref; |
|
257 | - $libelleline=$object->lines[$i]->label; |
|
256 | + $ref = $object->lines[$i]->ref; |
|
257 | + $libelleline = $object->lines[$i]->label; |
|
258 | 258 | //$progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':''); |
259 | - $datestart=dol_print_date($object->lines[$i]->date_start,'day'); |
|
260 | - $dateend=dol_print_date($object->lines[$i]->date_end,'day'); |
|
261 | - $planned_timespent=convertSecondToTime((int) $object->lines[$i]->planned_timespent,'allhourmin'); |
|
259 | + $datestart = dol_print_date($object->lines[$i]->date_start, 'day'); |
|
260 | + $dateend = dol_print_date($object->lines[$i]->date_end, 'day'); |
|
261 | + $planned_timespent = convertSecondToTime((int) $object->lines[$i]->planned_timespent, 'allhourmin'); |
|
262 | 262 | |
263 | - $showpricebeforepagebreak=1; |
|
263 | + $showpricebeforepagebreak = 1; |
|
264 | 264 | |
265 | 265 | $pdf->startTransaction(); |
266 | 266 | // Label |
267 | 267 | $pdf->SetXY($this->posxlabel, $curY); |
268 | - $pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
269 | - $pageposafter=$pdf->getPage(); |
|
268 | + $pdf->MultiCell($this->posxtimespent - $this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
269 | + $pageposafter = $pdf->getPage(); |
|
270 | 270 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
271 | 271 | { |
272 | 272 | $pdf->rollbackTransaction(true); |
273 | - $pageposafter=$pageposbefore; |
|
273 | + $pageposafter = $pageposbefore; |
|
274 | 274 | //print $pageposafter.'-'.$pageposbefore;exit; |
275 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
275 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
276 | 276 | // Label |
277 | 277 | $pdf->SetXY($this->posxlabel, $curY); |
278 | - $posybefore=$pdf->GetY(); |
|
279 | - $pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
280 | - $pageposafter=$pdf->getPage(); |
|
281 | - $posyafter=$pdf->GetY(); |
|
282 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
278 | + $posybefore = $pdf->GetY(); |
|
279 | + $pdf->MultiCell($this->posxtimespent - $this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
280 | + $pageposafter = $pdf->getPage(); |
|
281 | + $posyafter = $pdf->GetY(); |
|
282 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
283 | 283 | { |
284 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
284 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
285 | 285 | { |
286 | - $pdf->AddPage('','',true); |
|
287 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
286 | + $pdf->AddPage('', '', true); |
|
287 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
288 | 288 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
289 | - $pdf->setPage($pageposafter+1); |
|
289 | + $pdf->setPage($pageposafter + 1); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | else |
293 | 293 | { |
294 | 294 | // We found a page break |
295 | - $showpricebeforepagebreak=0; |
|
296 | - $forcedesconsamepage=1; |
|
295 | + $showpricebeforepagebreak = 0; |
|
296 | + $forcedesconsamepage = 1; |
|
297 | 297 | if ($forcedesconsamepage) |
298 | 298 | { |
299 | 299 | $pdf->rollbackTransaction(true); |
300 | - $pageposafter=$pageposbefore; |
|
301 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
300 | + $pageposafter = $pageposbefore; |
|
301 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
302 | 302 | |
303 | - $pdf->AddPage('','',true); |
|
304 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
303 | + $pdf->AddPage('', '', true); |
|
304 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
305 | 305 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
306 | - $pdf->setPage($pageposafter+1); |
|
307 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
308 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
309 | - $pdf->SetTextColor(0,0,0); |
|
306 | + $pdf->setPage($pageposafter + 1); |
|
307 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
308 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
309 | + $pdf->SetTextColor(0, 0, 0); |
|
310 | 310 | |
311 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
311 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
312 | 312 | $curY = $tab_top_newpage + $heightoftitleline + 1; |
313 | 313 | |
314 | 314 | // Label |
315 | 315 | $pdf->SetXY($this->posxlabel, $curY); |
316 | - $posybefore=$pdf->GetY(); |
|
317 | - $pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
318 | - $pageposafter=$pdf->getPage(); |
|
319 | - $posyafter=$pdf->GetY(); |
|
316 | + $posybefore = $pdf->GetY(); |
|
317 | + $pdf->MultiCell($this->posxtimespent - $this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); |
|
318 | + $pageposafter = $pdf->getPage(); |
|
319 | + $posyafter = $pdf->GetY(); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | { |
326 | 326 | $pdf->commitTransaction(); |
327 | 327 | } |
328 | - $posYAfterDescription=$pdf->GetY(); |
|
328 | + $posYAfterDescription = $pdf->GetY(); |
|
329 | 329 | |
330 | 330 | $nexY = $pdf->GetY(); |
331 | - $pageposafter=$pdf->getPage(); |
|
331 | + $pageposafter = $pdf->getPage(); |
|
332 | 332 | $pdf->setPage($pageposbefore); |
333 | 333 | $pdf->setTopMargin($this->marge_haute); |
334 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
334 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
335 | 335 | |
336 | 336 | // We suppose that a too long description is moved completely on next page |
337 | 337 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -339,34 +339,34 @@ discard block |
||
339 | 339 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; |
340 | 340 | } |
341 | 341 | |
342 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
342 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
343 | 343 | |
344 | 344 | // Ref of task |
345 | 345 | $pdf->SetXY($this->posxref, $curY); |
346 | - $pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); |
|
346 | + $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); |
|
347 | 347 | // timespent |
348 | 348 | $pdf->SetXY($this->posxtimespent, $curY); |
349 | - $pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $planned_timespent?$planned_timespent:'', 0, 'R'); |
|
349 | + $pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $planned_timespent ? $planned_timespent : '', 0, 'R'); |
|
350 | 350 | // Progress |
351 | 351 | //$pdf->SetXY($this->posxprogress, $curY); |
352 | 352 | //$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R'); |
353 | 353 | // Date |
354 | 354 | $pdf->SetXY($this->posxdatestart, $curY); |
355 | - $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C'); |
|
355 | + $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C'); |
|
356 | 356 | $pdf->SetXY($this->posxdateend, $curY); |
357 | - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C'); |
|
357 | + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $dateend, 0, 'C'); |
|
358 | 358 | |
359 | 359 | // Add line |
360 | - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
360 | + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
361 | 361 | { |
362 | 362 | $pdf->setPage($pageposafter); |
363 | - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); |
|
363 | + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); |
|
364 | 364 | //$pdf->SetDrawColor(190,190,200); |
365 | - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); |
|
365 | + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); |
|
366 | 366 | $pdf->SetLineStyle(array('dash'=>0)); |
367 | 367 | } |
368 | 368 | |
369 | - $nexY+=2; // Passe espace entre les lignes |
|
369 | + $nexY += 2; // Passe espace entre les lignes |
|
370 | 370 | |
371 | 371 | // Detect if some page were added automatically and output _tableau for past pages |
372 | 372 | while ($pagenb < $pageposafter) |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | { |
381 | 381 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
382 | 382 | } |
383 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
383 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
384 | 384 | $pagenb++; |
385 | 385 | $pdf->setPage($pagenb); |
386 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
386 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
387 | 387 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
388 | 388 | } |
389 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
389 | + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) |
|
390 | 390 | { |
391 | 391 | if ($pagenb == 1) |
392 | 392 | { |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | { |
397 | 397 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
398 | 398 | } |
399 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
399 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
400 | 400 | // New page |
401 | 401 | $pdf->AddPage(); |
402 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
402 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
403 | 403 | $pagenb++; |
404 | 404 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
405 | 405 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
411 | 411 | else |
412 | 412 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
413 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
413 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
414 | 414 | |
415 | 415 | // Pied de page |
416 | 416 | $this->_pagefoot($pdf, $object, $outputlangs); |
@@ -422,26 +422,26 @@ discard block |
||
422 | 422 | |
423 | 423 | // Add pdfgeneration hook |
424 | 424 | $hookmanager->initHooks(array('pdfgeneration')); |
425 | - $parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
425 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
426 | 426 | global $action; |
427 | - $reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
427 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
428 | 428 | |
429 | - if (! empty($conf->global->MAIN_UMASK)) |
|
429 | + if (!empty($conf->global->MAIN_UMASK)) |
|
430 | 430 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
431 | 431 | |
432 | 432 | $this->result = array('fullpath'=>$file); |
433 | 433 | |
434 | - return 1; // Pas d'erreur |
|
434 | + return 1; // Pas d'erreur |
|
435 | 435 | } |
436 | 436 | else |
437 | 437 | { |
438 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
438 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
439 | 439 | return 0; |
440 | 440 | } |
441 | 441 | } |
442 | 442 | else |
443 | 443 | { |
444 | - $this->error=$langs->transnoentities("ErrorConstantNotDefined","PROJECT_OUTPUTDIR"); |
|
444 | + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "PROJECT_OUTPUTDIR"); |
|
445 | 445 | return 0; |
446 | 446 | } |
447 | 447 | } |
@@ -459,41 +459,41 @@ discard block |
||
459 | 459 | * @param int $hidebottom Hide bottom bar of array |
460 | 460 | * @return void |
461 | 461 | */ |
462 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
462 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
463 | 463 | { |
464 | - global $conf,$mysoc; |
|
464 | + global $conf, $mysoc; |
|
465 | 465 | |
466 | 466 | $heightoftitleline = 10; |
467 | 467 | |
468 | 468 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
469 | 469 | |
470 | - $pdf->SetDrawColor(128,128,128); |
|
470 | + $pdf->SetDrawColor(128, 128, 128); |
|
471 | 471 | |
472 | 472 | // Draw rect of all tab (title + lines). Rect prend une longueur en 3eme param |
473 | - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); |
|
473 | + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height); |
|
474 | 474 | |
475 | 475 | // line prend une position y en 3eme param |
476 | - $pdf->line($this->marge_gauche, $tab_top+$heightoftitleline, $this->page_largeur-$this->marge_droite, $tab_top+$heightoftitleline); |
|
476 | + $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline); |
|
477 | 477 | |
478 | - $pdf->SetTextColor(0,0,0); |
|
479 | - $pdf->SetFont('','', $default_font_size); |
|
478 | + $pdf->SetTextColor(0, 0, 0); |
|
479 | + $pdf->SetFont('', '', $default_font_size); |
|
480 | 480 | |
481 | - $pdf->SetXY($this->posxref, $tab_top+1); |
|
482 | - $pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L'); |
|
481 | + $pdf->SetXY($this->posxref, $tab_top + 1); |
|
482 | + $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->transnoentities("Tasks"), '', 'L'); |
|
483 | 483 | |
484 | - $pdf->SetXY($this->posxlabel, $tab_top+1); |
|
485 | - $pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); |
|
484 | + $pdf->SetXY($this->posxlabel, $tab_top + 1); |
|
485 | + $pdf->MultiCell($this->posxtimespent - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); |
|
486 | 486 | |
487 | - $pdf->SetXY($this->posxtimespent, $tab_top+1); |
|
488 | - $pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R'); |
|
487 | + $pdf->SetXY($this->posxtimespent, $tab_top + 1); |
|
488 | + $pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R'); |
|
489 | 489 | |
490 | 490 | //$pdf->SetXY($this->posxprogress, $tab_top+1); |
491 | 491 | //$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R'); |
492 | 492 | |
493 | - $pdf->SetXY($this->posxdatestart, $tab_top+1); |
|
494 | - $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $outputlangs->transnoentities("Date"), 0, 'C'); |
|
493 | + $pdf->SetXY($this->posxdatestart, $tab_top + 1); |
|
494 | + $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $outputlangs->transnoentities("Date"), 0, 'C'); |
|
495 | 495 | |
496 | - $pdf->SetXY($this->posxdateend, $tab_top+1); |
|
496 | + $pdf->SetXY($this->posxdateend, $tab_top + 1); |
|
497 | 497 | $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); |
498 | 498 | } |
499 | 499 | |
@@ -508,62 +508,62 @@ discard block |
||
508 | 508 | */ |
509 | 509 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
510 | 510 | { |
511 | - global $langs,$conf,$mysoc; |
|
511 | + global $langs, $conf, $mysoc; |
|
512 | 512 | |
513 | 513 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
514 | 514 | |
515 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
515 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
516 | 516 | |
517 | - $pdf->SetTextColor(0,0,60); |
|
518 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
517 | + $pdf->SetTextColor(0, 0, 60); |
|
518 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
519 | 519 | |
520 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
521 | - $posy=$this->marge_haute; |
|
520 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
521 | + $posy = $this->marge_haute; |
|
522 | 522 | |
523 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
523 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
524 | 524 | |
525 | 525 | // Logo |
526 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
526 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
527 | 527 | if ($mysoc->logo) |
528 | 528 | { |
529 | 529 | if (is_readable($logo)) |
530 | 530 | { |
531 | - $height=pdf_getHeightForLogo($logo); |
|
532 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
531 | + $height = pdf_getHeightForLogo($logo); |
|
532 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
533 | 533 | } |
534 | 534 | else |
535 | 535 | { |
536 | - $pdf->SetTextColor(200,0,0); |
|
537 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
538 | - $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
536 | + $pdf->SetTextColor(200, 0, 0); |
|
537 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
538 | + $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
539 | 539 | $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); |
540 | 540 | } |
541 | 541 | } |
542 | 542 | else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); |
543 | 543 | |
544 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
545 | - $pdf->SetXY($posx,$posy); |
|
546 | - $pdf->SetTextColor(0,0,60); |
|
544 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
545 | + $pdf->SetXY($posx, $posy); |
|
546 | + $pdf->SetTextColor(0, 0, 60); |
|
547 | 547 | $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
548 | - $pdf->SetFont('','', $default_font_size + 2); |
|
548 | + $pdf->SetFont('', '', $default_font_size + 2); |
|
549 | 549 | |
550 | - $posy+=6; |
|
551 | - $pdf->SetXY($posx,$posy); |
|
552 | - $pdf->SetTextColor(0,0,60); |
|
553 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R'); |
|
550 | + $posy += 6; |
|
551 | + $pdf->SetXY($posx, $posy); |
|
552 | + $pdf->SetTextColor(0, 0, 60); |
|
553 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : ".dol_print_date($object->date_start, 'day', false, $outputlangs, true), '', 'R'); |
|
554 | 554 | |
555 | - $posy+=6; |
|
556 | - $pdf->SetXY($posx,$posy); |
|
557 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R'); |
|
555 | + $posy += 6; |
|
556 | + $pdf->SetXY($posx, $posy); |
|
557 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : ".dol_print_date($object->date_end, 'day', false, $outputlangs, true), '', 'R'); |
|
558 | 558 | |
559 | 559 | if (is_object($object->thirdparty)) |
560 | 560 | { |
561 | - $posy+=6; |
|
562 | - $pdf->SetXY($posx,$posy); |
|
563 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R'); |
|
561 | + $posy += 6; |
|
562 | + $pdf->SetXY($posx, $posy); |
|
563 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : ".$object->thirdparty->getFullName($outputlangs), '', 'R'); |
|
564 | 564 | } |
565 | 565 | |
566 | - $pdf->SetTextColor(0,0,60); |
|
566 | + $pdf->SetTextColor(0, 0, 60); |
|
567 | 567 | |
568 | 568 | // Add list of linked objects |
569 | 569 | /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc.... |
@@ -599,10 +599,10 @@ discard block |
||
599 | 599 | * @param int $hidefreetext 1=Hide free text |
600 | 600 | * @return integer |
601 | 601 | */ |
602 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
602 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
603 | 603 | { |
604 | 604 | global $conf; |
605 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
606 | - return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
605 | + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
606 | + return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
607 | 607 | } |
608 | 608 | } |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
38 | 38 | require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; |
39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
40 | -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
41 | -if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
42 | -if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; |
|
43 | -if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
44 | -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
45 | -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
46 | -if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
47 | -if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
48 | -if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; |
|
49 | -if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
40 | +if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
41 | +if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
42 | +if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; |
|
43 | +if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
44 | +if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
45 | +if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
46 | +if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
47 | +if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
48 | +if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; |
|
49 | +if (!empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
50 | 50 | |
51 | 51 | |
52 | 52 | /** |
@@ -88,32 +88,32 @@ discard block |
||
88 | 88 | $this->db = $db; |
89 | 89 | $this->name = "ODT templates"; |
90 | 90 | $this->description = $langs->trans("DocumentModelOdt"); |
91 | - $this->scandir = 'PROJECT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan |
|
91 | + $this->scandir = 'PROJECT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan |
|
92 | 92 | |
93 | 93 | // Dimension page pour format A4 |
94 | 94 | $this->type = 'odt'; |
95 | 95 | $this->page_largeur = 0; |
96 | 96 | $this->page_hauteur = 0; |
97 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
98 | - $this->marge_gauche=0; |
|
99 | - $this->marge_droite=0; |
|
100 | - $this->marge_haute=0; |
|
101 | - $this->marge_basse=0; |
|
102 | - |
|
103 | - $this->option_logo = 1; // Affiche logo |
|
104 | - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION |
|
105 | - $this->option_modereg = 0; // Affiche mode reglement |
|
106 | - $this->option_condreg = 0; // Affiche conditions reglement |
|
107 | - $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
108 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
109 | - $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
110 | - $this->option_credit_note = 0; // Support credit notes |
|
111 | - $this->option_freetext = 1; // Support add of a personalised text |
|
112 | - $this->option_draft_watermark = 0; // Support add of a watermark on drafts |
|
97 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
98 | + $this->marge_gauche = 0; |
|
99 | + $this->marge_droite = 0; |
|
100 | + $this->marge_haute = 0; |
|
101 | + $this->marge_basse = 0; |
|
102 | + |
|
103 | + $this->option_logo = 1; // Affiche logo |
|
104 | + $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION |
|
105 | + $this->option_modereg = 0; // Affiche mode reglement |
|
106 | + $this->option_condreg = 0; // Affiche conditions reglement |
|
107 | + $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
108 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
109 | + $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
110 | + $this->option_credit_note = 0; // Support credit notes |
|
111 | + $this->option_freetext = 1; // Support add of a personalised text |
|
112 | + $this->option_draft_watermark = 0; // Support add of a watermark on drafts |
|
113 | 113 | |
114 | 114 | // Recupere emetteur |
115 | - $this->emetteur=$mysoc; |
|
116 | - if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini |
|
115 | + $this->emetteur = $mysoc; |
|
116 | + if (!$this->emetteur->pays_code) $this->emetteur->pays_code = substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | * @param string $array_key Name of the key for return array |
127 | 127 | * @return array Array of substitution |
128 | 128 | */ |
129 | - function get_substitutionarray_object($object,$outputlangs,$array_key='object') |
|
129 | + function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') |
|
130 | 130 | { |
131 | 131 | // phpcs:enable |
132 | 132 | global $conf; |
133 | 133 | |
134 | - $resarray=array( |
|
134 | + $resarray = array( |
|
135 | 135 | $array_key.'_id'=>$object->id, |
136 | 136 | $array_key.'_ref'=>$object->ref, |
137 | 137 | $array_key.'_title'=>$object->title, |
138 | 138 | $array_key.'_description'=>$object->description, |
139 | - $array_key.'_date_creation'=>dol_print_date($object->date_c,'day'), |
|
140 | - $array_key.'_date_modification'=>dol_print_date($object->date_m,'day'), |
|
141 | - $array_key.'_date_start'=>dol_print_date($object->date_start,'day'), |
|
142 | - $array_key.'_date_end'=>dol_print_date($object->date_end,'day'), |
|
139 | + $array_key.'_date_creation'=>dol_print_date($object->date_c, 'day'), |
|
140 | + $array_key.'_date_modification'=>dol_print_date($object->date_m, 'day'), |
|
141 | + $array_key.'_date_start'=>dol_print_date($object->date_start, 'day'), |
|
142 | + $array_key.'_date_end'=>dol_print_date($object->date_end, 'day'), |
|
143 | 143 | $array_key.'_note_private'=>$object->note_private, |
144 | 144 | $array_key.'_note_public'=>$object->note_public, |
145 | 145 | $array_key.'_public'=>$object->public, |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | |
149 | 149 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
150 | 150 | $extrafields = new ExtraFields($this->db); |
151 | - $extralabels = $extrafields->fetch_name_optionals_label($object->table_element,true); |
|
151 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element, true); |
|
152 | 152 | $object->fetch_optionals(); |
153 | 153 | |
154 | - $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); |
|
154 | + $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); |
|
155 | 155 | |
156 | 156 | return $resarray; |
157 | 157 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param Translate $outputlangs Lang object to use for output |
165 | 165 | * @return array Return a substitution array |
166 | 166 | */ |
167 | - function get_substitutionarray_tasks(Task $task,$outputlangs) |
|
167 | + function get_substitutionarray_tasks(Task $task, $outputlangs) |
|
168 | 168 | { |
169 | 169 | // phpcs:enable |
170 | 170 | global $conf; |
@@ -178,21 +178,21 @@ discard block |
||
178 | 178 | 'task_description'=>$task->description, |
179 | 179 | 'task_fk_parent'=>$task->fk_parent, |
180 | 180 | 'task_duration'=>$task->duration, |
181 | - 'task_duration_hour'=>convertSecondToTime($task->duration,'all'), |
|
181 | + 'task_duration_hour'=>convertSecondToTime($task->duration, 'all'), |
|
182 | 182 | 'task_progress'=>$task->progress, |
183 | 183 | 'task_public'=>$task->public, |
184 | - 'task_date_start'=>dol_print_date($task->date_start,'day'), |
|
185 | - 'task_date_end'=>dol_print_date($task->date_end,'day'), |
|
184 | + 'task_date_start'=>dol_print_date($task->date_start, 'day'), |
|
185 | + 'task_date_end'=>dol_print_date($task->date_end, 'day'), |
|
186 | 186 | 'task_note_private'=>$task->note_private, |
187 | 187 | 'task_note_public'=>$task->note_public |
188 | 188 | ); |
189 | 189 | |
190 | 190 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
191 | 191 | $extrafields = new ExtraFields($this->db); |
192 | - $extralabels = $extrafields->fetch_name_optionals_label($task->table_element,true); |
|
193 | - $task->fetch_optionals($task->id,$extralabels); |
|
192 | + $extralabels = $extrafields->fetch_name_optionals_label($task->table_element, true); |
|
193 | + $task->fetch_optionals($task->id, $extralabels); |
|
194 | 194 | |
195 | - $resarray = $this->fill_substitutionarray_with_extrafields($task,$resarray,$extrafields,'task',$outputlangs); |
|
195 | + $resarray = $this->fill_substitutionarray_with_extrafields($task, $resarray, $extrafields, 'task', $outputlangs); |
|
196 | 196 | |
197 | 197 | return $resarray; |
198 | 198 | } |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | * @param Translate $outputlangs Lang object to use for output |
206 | 206 | * @return array Return a substitution array |
207 | 207 | */ |
208 | - function get_substitutionarray_project_contacts($contact,$outputlangs) |
|
208 | + function get_substitutionarray_project_contacts($contact, $outputlangs) |
|
209 | 209 | { |
210 | 210 | // phpcs:enable |
211 | 211 | global $conf; |
212 | - $pc='projcontacts_'; // prefix to avoid typos |
|
212 | + $pc = 'projcontacts_'; // prefix to avoid typos |
|
213 | 213 | |
214 | 214 | $ret = array( |
215 | 215 | $pc.'id'=>$contact['id'], |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $pc.'email'=>$contact['email'] |
224 | 224 | ); |
225 | 225 | |
226 | - if ($contact['source']=='external') { |
|
226 | + if ($contact['source'] == 'external') { |
|
227 | 227 | $ret[$pc.'isInternal'] = ''; // not internal |
228 | 228 | |
229 | 229 | $ct = new Contact($this->db); |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | |
235 | 235 | // fetch external user extrafields |
236 | 236 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
237 | - $extrafields=new ExtraFields($this->db); |
|
238 | - $extralabels=$extrafields->fetch_name_optionals_label($ct->table_element, true); |
|
237 | + $extrafields = new ExtraFields($this->db); |
|
238 | + $extralabels = $extrafields->fetch_name_optionals_label($ct->table_element, true); |
|
239 | 239 | $extrafields_num = $ct->fetch_optionals(); |
240 | 240 | //dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: ===== Number of Extrafields found: ".$extrafields_num, LOG_DEBUG); |
241 | - foreach($ct->array_options as $efkey => $efval) { |
|
241 | + foreach ($ct->array_options as $efkey => $efval) { |
|
242 | 242 | dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: +++++ Extrafield ".$efkey." => ".$efval, LOG_DEBUG); |
243 | 243 | $ret[$pc.$efkey] = $efval; // add nothing else because it already comes as 'options_XX' |
244 | 244 | } |
245 | - } elseif ($contact['source']=='internal') { |
|
245 | + } elseif ($contact['source'] == 'internal') { |
|
246 | 246 | $ret[$pc.'isInternal'] = '1'; // this is an internal user |
247 | 247 | |
248 | 248 | $ct = new User($this->db); |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | * @param Translate $outputlangs Lang object to use for output |
264 | 264 | * @return array Return a substitution array |
265 | 265 | */ |
266 | - function get_substitutionarray_project_file($file,$outputlangs) |
|
266 | + function get_substitutionarray_project_file($file, $outputlangs) |
|
267 | 267 | { |
268 | 268 | // phpcs:enable |
269 | 269 | global $conf; |
270 | 270 | |
271 | 271 | return array( |
272 | 272 | 'projfile_name'=>$file['name'], |
273 | - 'projfile_date'=>dol_print_date($file['date'],'day'), |
|
273 | + 'projfile_date'=>dol_print_date($file['date'], 'day'), |
|
274 | 274 | 'projfile_size'=>$file['size'] |
275 | 275 | ); |
276 | 276 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @param Translate $outputlangs Lang object to use for output |
284 | 284 | * @return array Return a substitution array |
285 | 285 | */ |
286 | - function get_substitutionarray_project_reference($refdetail,$outputlangs) |
|
286 | + function get_substitutionarray_project_reference($refdetail, $outputlangs) |
|
287 | 287 | { |
288 | 288 | // phpcs:enable |
289 | 289 | global $conf; |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | return array( |
292 | 292 | 'projref_type'=>$refdetail['type'], |
293 | 293 | 'projref_ref'=>$refdetail['ref'], |
294 | - 'projref_date'=>dol_print_date($refdetail['date'],'day'), |
|
294 | + 'projref_date'=>dol_print_date($refdetail['date'], 'day'), |
|
295 | 295 | 'projref_socname'=>$refdetail['socname'], |
296 | - 'projref_amountht'=>price($refdetail['amountht'],0,$outputlangs), |
|
297 | - 'projref_amountttc'=>price($refdetail['amountttc'],0,$outputlangs), |
|
296 | + 'projref_amountht'=>price($refdetail['amountht'], 0, $outputlangs), |
|
297 | + 'projref_amountttc'=>price($refdetail['amountttc'], 0, $outputlangs), |
|
298 | 298 | 'projref_status'=>$refdetail['status'] |
299 | 299 | ); |
300 | 300 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @param Translate $outputlangs Lang object to use for output |
308 | 308 | * @return array Return a substitution array |
309 | 309 | */ |
310 | - function get_substitutionarray_tasksressource($taskressource,$outputlangs) |
|
310 | + function get_substitutionarray_tasksressource($taskressource, $outputlangs) |
|
311 | 311 | { |
312 | 312 | // phpcs:enable |
313 | 313 | global $conf; |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | * @param Translate $outputlangs Lang object to use for output |
332 | 332 | * @return array Return a substitution array |
333 | 333 | */ |
334 | - function get_substitutionarray_taskstime($tasktime,$outputlangs) |
|
334 | + function get_substitutionarray_taskstime($tasktime, $outputlangs) |
|
335 | 335 | { |
336 | 336 | // phpcs:enable |
337 | 337 | global $conf; |
338 | 338 | |
339 | 339 | return array( |
340 | 340 | 'tasktime_rowid'=>$tasktime['rowid'], |
341 | - 'tasktime_task_date'=>dol_print_date($tasktime['task_date'],'day'), |
|
341 | + 'tasktime_task_date'=>dol_print_date($tasktime['task_date'], 'day'), |
|
342 | 342 | 'tasktime_task_duration_sec'=>$tasktime['task_duration'], |
343 | - 'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'],'all'), |
|
343 | + 'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'], 'all'), |
|
344 | 344 | 'tasktime_note'=>$tasktime['note'], |
345 | 345 | 'tasktime_fk_user'=>$tasktime['fk_user'], |
346 | 346 | 'tasktime_user_name'=>$tasktime['name'], |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | * @param Translate $outputlangs Lang object to use for output |
361 | 361 | * @return array Return a substitution array |
362 | 362 | */ |
363 | - function get_substitutionarray_task_file($file,$outputlangs) |
|
363 | + function get_substitutionarray_task_file($file, $outputlangs) |
|
364 | 364 | { |
365 | 365 | // phpcs:enable |
366 | 366 | global $conf; |
367 | 367 | |
368 | 368 | return array( |
369 | 369 | 'tasksfile_name'=>$file['name'], |
370 | - 'tasksfile_date'=>dol_print_date($file['date'],'day'), |
|
370 | + 'tasksfile_date'=>dol_print_date($file['date'], 'day'), |
|
371 | 371 | 'tasksfile_size'=>$file['size'] |
372 | 372 | ); |
373 | 373 | } |
@@ -381,83 +381,83 @@ discard block |
||
381 | 381 | */ |
382 | 382 | function info($langs) |
383 | 383 | { |
384 | - global $conf,$langs; |
|
384 | + global $conf, $langs; |
|
385 | 385 | |
386 | 386 | // Load translation files required by the page |
387 | - $langs->loadLangs(array("companies","errors")); |
|
387 | + $langs->loadLangs(array("companies", "errors")); |
|
388 | 388 | |
389 | 389 | $form = new Form($this->db); |
390 | 390 | |
391 | 391 | $texte = $this->description.".<br>\n"; |
392 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
393 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
394 | - $texte.= '<input type="hidden" name="action" value="setModuleOptions">'; |
|
395 | - $texte.= '<input type="hidden" name="param1" value="PROJECT_ADDON_PDF_ODT_PATH">'; |
|
396 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
392 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
393 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
394 | + $texte .= '<input type="hidden" name="action" value="setModuleOptions">'; |
|
395 | + $texte .= '<input type="hidden" name="param1" value="PROJECT_ADDON_PDF_ODT_PATH">'; |
|
396 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
397 | 397 | |
398 | 398 | // List of directories area |
399 | - $texte.= '<tr><td>'; |
|
400 | - $texttitle=$langs->trans("ListOfDirectories"); |
|
401 | - $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->PROJECT_ADDON_PDF_ODT_PATH))); |
|
402 | - $listoffiles=array(); |
|
403 | - foreach($listofdir as $key=>$tmpdir) |
|
399 | + $texte .= '<tr><td>'; |
|
400 | + $texttitle = $langs->trans("ListOfDirectories"); |
|
401 | + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROJECT_ADDON_PDF_ODT_PATH))); |
|
402 | + $listoffiles = array(); |
|
403 | + foreach ($listofdir as $key=>$tmpdir) |
|
404 | 404 | { |
405 | - $tmpdir=trim($tmpdir); |
|
406 | - $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); |
|
407 | - if (! $tmpdir) { |
|
405 | + $tmpdir = trim($tmpdir); |
|
406 | + $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); |
|
407 | + if (!$tmpdir) { |
|
408 | 408 | unset($listofdir[$key]); continue; |
409 | 409 | } |
410 | - if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
410 | + if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); |
|
411 | 411 | else |
412 | 412 | { |
413 | - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); |
|
414 | - if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
413 | + $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); |
|
414 | + if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); |
|
415 | 415 | } |
416 | 416 | } |
417 | - $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); |
|
417 | + $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT"); |
|
418 | 418 | // Add list of substitution keys |
419 | - $texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>'; |
|
420 | - $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it |
|
421 | - |
|
422 | - $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); |
|
423 | - $texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">'; |
|
424 | - $texte.= '<textarea class="flat" cols="60" name="value1">'; |
|
425 | - $texte.=$conf->global->PROJECT_ADDON_PDF_ODT_PATH; |
|
426 | - $texte.= '</textarea>'; |
|
427 | - $texte.= '</div><div style="display: inline-block; vertical-align: middle;">'; |
|
428 | - $texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">'; |
|
429 | - $texte.= '<br></div></div>'; |
|
419 | + $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>'; |
|
420 | + $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it |
|
421 | + |
|
422 | + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); |
|
423 | + $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">'; |
|
424 | + $texte .= '<textarea class="flat" cols="60" name="value1">'; |
|
425 | + $texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH; |
|
426 | + $texte .= '</textarea>'; |
|
427 | + $texte .= '</div><div style="display: inline-block; vertical-align: middle;">'; |
|
428 | + $texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">'; |
|
429 | + $texte .= '<br></div></div>'; |
|
430 | 430 | |
431 | 431 | // Scan directories |
432 | - $nbofiles=count($listoffiles); |
|
433 | - if (! empty($conf->global->PROJECT_ADDON_PDF_ODT_PATH)) |
|
432 | + $nbofiles = count($listoffiles); |
|
433 | + if (!empty($conf->global->PROJECT_ADDON_PDF_ODT_PATH)) |
|
434 | 434 | { |
435 | - $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; |
|
435 | + $texte .= $langs->trans("NumberOfModelFilesFound").': <b>'; |
|
436 | 436 | //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; |
437 | - $texte.=$nbofiles; |
|
437 | + $texte .= $nbofiles; |
|
438 | 438 | //$texte.=$nbofiles?'</a>':''; |
439 | - $texte.='</b>'; |
|
439 | + $texte .= '</b>'; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | if ($nbofiles) |
443 | 443 | { |
444 | - $texte.='<div id="div_'.get_class($this).'" class="hidden">'; |
|
445 | - foreach($listoffiles as $file) |
|
444 | + $texte .= '<div id="div_'.get_class($this).'" class="hidden">'; |
|
445 | + foreach ($listoffiles as $file) |
|
446 | 446 | { |
447 | - $texte.=$file['name'].'<br>'; |
|
447 | + $texte .= $file['name'].'<br>'; |
|
448 | 448 | } |
449 | - $texte.='<div id="div_'.get_class($this).'">'; |
|
449 | + $texte .= '<div id="div_'.get_class($this).'">'; |
|
450 | 450 | } |
451 | 451 | |
452 | - $texte.= '</td>'; |
|
452 | + $texte .= '</td>'; |
|
453 | 453 | |
454 | - $texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">'; |
|
455 | - $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); |
|
456 | - $texte.= '</td>'; |
|
457 | - $texte.= '</tr>'; |
|
454 | + $texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">'; |
|
455 | + $texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); |
|
456 | + $texte .= '</td>'; |
|
457 | + $texte .= '</tr>'; |
|
458 | 458 | |
459 | - $texte.= '</table>'; |
|
460 | - $texte.= '</form>'; |
|
459 | + $texte .= '</table>'; |
|
460 | + $texte .= '</form>'; |
|
461 | 461 | |
462 | 462 | return $texte; |
463 | 463 | } |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | * @param string $srctemplatepath Full path of source filename for generator using a template file |
472 | 472 | * @return int 1 if OK, <=0 if KO |
473 | 473 | */ |
474 | - function write_file($object,$outputlangs,$srctemplatepath) |
|
474 | + function write_file($object, $outputlangs, $srctemplatepath) |
|
475 | 475 | { |
476 | 476 | // phpcs:enable |
477 | - global $user,$langs,$conf,$mysoc,$hookmanager; |
|
477 | + global $user, $langs, $conf, $mysoc, $hookmanager; |
|
478 | 478 | |
479 | 479 | if (empty($srctemplatepath)) |
480 | 480 | { |
@@ -483,17 +483,17 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | // Add odtgeneration hook |
486 | - if (! is_object($hookmanager)) |
|
486 | + if (!is_object($hookmanager)) |
|
487 | 487 | { |
488 | 488 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
489 | - $hookmanager=new HookManager($this->db); |
|
489 | + $hookmanager = new HookManager($this->db); |
|
490 | 490 | } |
491 | 491 | $hookmanager->initHooks(array('odtgeneration')); |
492 | 492 | global $action; |
493 | 493 | |
494 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
495 | - $sav_charset_output=$outputlangs->charset_output; |
|
496 | - $outputlangs->charset_output='UTF-8'; |
|
494 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
495 | + $sav_charset_output = $outputlangs->charset_output; |
|
496 | + $outputlangs->charset_output = 'UTF-8'; |
|
497 | 497 | |
498 | 498 | // Load translation files required by the page |
499 | 499 | $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); |
@@ -501,28 +501,28 @@ discard block |
||
501 | 501 | if ($conf->projet->dir_output) |
502 | 502 | { |
503 | 503 | // If $object is id instead of object |
504 | - if (! is_object($object)) |
|
504 | + if (!is_object($object)) |
|
505 | 505 | { |
506 | 506 | $id = $object; |
507 | 507 | $object = new Project($this->db); |
508 | - $result=$object->fetch($id); |
|
508 | + $result = $object->fetch($id); |
|
509 | 509 | if ($result < 0) |
510 | 510 | { |
511 | - dol_print_error($this->db,$object->error); |
|
511 | + dol_print_error($this->db, $object->error); |
|
512 | 512 | return -1; |
513 | 513 | } |
514 | 514 | } |
515 | 515 | |
516 | 516 | $dir = $conf->projet->dir_output; |
517 | 517 | $objectref = dol_sanitizeFileName($object->ref); |
518 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
519 | - $file = $dir . "/" . $objectref . ".odt"; |
|
518 | + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; |
|
519 | + $file = $dir."/".$objectref.".odt"; |
|
520 | 520 | |
521 | - if (! file_exists($dir)) |
|
521 | + if (!file_exists($dir)) |
|
522 | 522 | { |
523 | 523 | if (dol_mkdir($dir) < 0) |
524 | 524 | { |
525 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
525 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
526 | 526 | return -1; |
527 | 527 | } |
528 | 528 | } |
@@ -530,25 +530,25 @@ discard block |
||
530 | 530 | if (file_exists($dir)) |
531 | 531 | { |
532 | 532 | //print "srctemplatepath=".$srctemplatepath; // Src filename |
533 | - $newfile=basename($srctemplatepath); |
|
534 | - $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile); |
|
535 | - $newfiletmp=preg_replace('/template_/i','',$newfiletmp); |
|
536 | - $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); |
|
537 | - $newfiletmp=$objectref.'_'.$newfiletmp; |
|
533 | + $newfile = basename($srctemplatepath); |
|
534 | + $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); |
|
535 | + $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); |
|
536 | + $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); |
|
537 | + $newfiletmp = $objectref.'_'.$newfiletmp; |
|
538 | 538 | //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; |
539 | 539 | // Get extension (ods or odt) |
540 | - $newfileformat=substr($newfile, strrpos($newfile, '.')+1); |
|
541 | - if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) |
|
540 | + $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); |
|
541 | + if (!empty($conf->global->MAIN_DOC_USE_TIMING)) |
|
542 | 542 | { |
543 | - $format=$conf->global->MAIN_DOC_USE_TIMING; |
|
544 | - if ($format == '1') $format='%Y%m%d%H%M%S'; |
|
545 | - $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; |
|
543 | + $format = $conf->global->MAIN_DOC_USE_TIMING; |
|
544 | + if ($format == '1') $format = '%Y%m%d%H%M%S'; |
|
545 | + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; |
|
546 | 546 | } |
547 | 547 | else |
548 | 548 | { |
549 | - $filename=$newfiletmp.'.'.$newfileformat; |
|
549 | + $filename = $newfiletmp.'.'.$newfileformat; |
|
550 | 550 | } |
551 | - $file=$dir.'/'.$filename; |
|
551 | + $file = $dir.'/'.$filename; |
|
552 | 552 | //print "newdir=".$dir; |
553 | 553 | //print "newfile=".$newfile; |
554 | 554 | //print "file=".$file; |
@@ -557,33 +557,33 @@ discard block |
||
557 | 557 | dol_mkdir($conf->projet->dir_temp); |
558 | 558 | |
559 | 559 | // If PROJECTLEADER contact defined on project, we use it |
560 | - $usecontact=false; |
|
561 | - $arrayidcontact=$object->getIdContact('external','PROJECTLEADER'); |
|
560 | + $usecontact = false; |
|
561 | + $arrayidcontact = $object->getIdContact('external', 'PROJECTLEADER'); |
|
562 | 562 | if (count($arrayidcontact) > 0) |
563 | 563 | { |
564 | - $usecontact=true; |
|
565 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
564 | + $usecontact = true; |
|
565 | + $result = $object->fetch_contact($arrayidcontact[0]); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | // Recipient name |
569 | - $contactobject=null; |
|
570 | - if (! empty($usecontact)) |
|
569 | + $contactobject = null; |
|
570 | + if (!empty($usecontact)) |
|
571 | 571 | { |
572 | 572 | // if we have a PROJECTLEADER contact and we dont use it as recipient we store the contact object for later use |
573 | 573 | $contactobject = $object->contact; |
574 | 574 | } |
575 | 575 | |
576 | - $socobject=$object->thirdparty; |
|
576 | + $socobject = $object->thirdparty; |
|
577 | 577 | |
578 | 578 | // Make substitution |
579 | - $substitutionarray=array( |
|
579 | + $substitutionarray = array( |
|
580 | 580 | '__FROM_NAME__' => $this->emetteur->name, |
581 | 581 | '__FROM_EMAIL__' => $this->emetteur->email, |
582 | 582 | ); |
583 | 583 | complete_substitutions_array($substitutionarray, $langs, $object); |
584 | 584 | // Call the ODTSubstitution hook |
585 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); |
|
586 | - $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
585 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); |
|
586 | + $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
587 | 587 | |
588 | 588 | // Open and load template |
589 | 589 | require_once ODTPHP_PATH.'odf.php'; |
@@ -592,13 +592,13 @@ discard block |
||
592 | 592 | $srctemplatepath, |
593 | 593 | array( |
594 | 594 | 'PATH_TO_TMP' => $conf->projet->dir_temp, |
595 | - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. |
|
595 | + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. |
|
596 | 596 | 'DELIMITER_LEFT' => '{', |
597 | 597 | 'DELIMITER_RIGHT' => '}' |
598 | 598 | ) |
599 | 599 | ); |
600 | 600 | } catch (Exception $e) { |
601 | - $this->error=$e->getMessage(); |
|
601 | + $this->error = $e->getMessage(); |
|
602 | 602 | dol_syslog($e->getMessage(), LOG_INFO); |
603 | 603 | return -1; |
604 | 604 | } |
@@ -612,26 +612,26 @@ discard block |
||
612 | 612 | // Define substitution array |
613 | 613 | $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); |
614 | 614 | $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs); |
615 | - $array_objet=$this->get_substitutionarray_object($object,$outputlangs); |
|
616 | - $array_user=$this->get_substitutionarray_user($user,$outputlangs); |
|
617 | - $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); |
|
618 | - $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); |
|
619 | - $array_other=$this->get_substitutionarray_other($outputlangs); |
|
615 | + $array_objet = $this->get_substitutionarray_object($object, $outputlangs); |
|
616 | + $array_user = $this->get_substitutionarray_user($user, $outputlangs); |
|
617 | + $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); |
|
618 | + $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); |
|
619 | + $array_other = $this->get_substitutionarray_other($outputlangs); |
|
620 | 620 | // retrieve contact information for use in object as contact_xxx tags |
621 | 621 | $array_project_contact = array(); |
622 | - if ($usecontact && is_object($contactobject)) $array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
622 | + if ($usecontact && is_object($contactobject)) $array_project_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); |
|
623 | 623 | |
624 | - $tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact); |
|
624 | + $tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_project_contact); |
|
625 | 625 | complete_substitutions_array($tmparray, $outputlangs, $object); |
626 | 626 | |
627 | 627 | // Call the ODTSubstitution hook |
628 | - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); |
|
629 | - $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
628 | + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); |
|
629 | + $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
630 | 630 | |
631 | - foreach($tmparray as $key=>$value) |
|
631 | + foreach ($tmparray as $key=>$value) |
|
632 | 632 | { |
633 | 633 | try { |
634 | - if (preg_match('/logo$/',$key)) // Image |
|
634 | + if (preg_match('/logo$/', $key)) // Image |
|
635 | 635 | { |
636 | 636 | if (file_exists($value)) $odfHandler->setImage($key, $value); |
637 | 637 | else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
@@ -655,43 +655,43 @@ discard block |
||
655 | 655 | $taskstatic = new Task($this->db); |
656 | 656 | |
657 | 657 | // Security check |
658 | - $socid=0; |
|
658 | + $socid = 0; |
|
659 | 659 | if (!empty($object->fk_soc)) $socid = $object->fk_soc; |
660 | 660 | |
661 | - $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0); |
|
661 | + $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $socid, 0); |
|
662 | 662 | |
663 | 663 | |
664 | 664 | foreach ($tasksarray as $task) |
665 | 665 | { |
666 | - $tmparray=$this->get_substitutionarray_tasks($task,$outputlangs); |
|
666 | + $tmparray = $this->get_substitutionarray_tasks($task, $outputlangs); |
|
667 | 667 | //complete_substitutions_array($tmparray, $outputlangs, $object, $task, "completesubstitutionarray_lines"); |
668 | - foreach($tmparray as $key => $val) |
|
668 | + foreach ($tmparray as $key => $val) |
|
669 | 669 | { |
670 | 670 | try |
671 | 671 | { |
672 | 672 | $listlines->setVars($key, $val, true, 'UTF-8'); |
673 | 673 | } |
674 | - catch(OdfException $e) |
|
674 | + catch (OdfException $e) |
|
675 | 675 | { |
676 | 676 | dol_syslog($e->getMessage(), LOG_INFO); |
677 | 677 | } |
678 | - catch(SegmentException $e) |
|
678 | + catch (SegmentException $e) |
|
679 | 679 | { |
680 | 680 | dol_syslog($e->getMessage(), LOG_INFO); |
681 | 681 | } |
682 | 682 | } |
683 | 683 | |
684 | - $taskobj=new Task($this->db); |
|
684 | + $taskobj = new Task($this->db); |
|
685 | 685 | $taskobj->fetch($task->id); |
686 | 686 | |
687 | 687 | // Replace tags of lines for contacts task |
688 | - $sourcearray=array('internal','external'); |
|
689 | - $contact_arrray=array(); |
|
688 | + $sourcearray = array('internal', 'external'); |
|
689 | + $contact_arrray = array(); |
|
690 | 690 | foreach ($sourcearray as $source) { |
691 | - $contact_temp=$taskobj->liste_contact(-1,$source); |
|
691 | + $contact_temp = $taskobj->liste_contact(-1, $source); |
|
692 | 692 | if ((is_array($contact_temp) && count($contact_temp) > 0)) |
693 | 693 | { |
694 | - $contact_arrray=array_merge($contact_arrray,$contact_temp); |
|
694 | + $contact_arrray = array_merge($contact_arrray, $contact_temp); |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | if ((is_array($contact_arrray) && count($contact_arrray) > 0)) |
@@ -700,33 +700,33 @@ discard block |
||
700 | 700 | |
701 | 701 | foreach ($contact_arrray as $contact) |
702 | 702 | { |
703 | - if ($contact['source']=='internal') { |
|
704 | - $objectdetail=new User($this->db); |
|
703 | + if ($contact['source'] == 'internal') { |
|
704 | + $objectdetail = new User($this->db); |
|
705 | 705 | $objectdetail->fetch($contact['id']); |
706 | - $contact['socname']=$mysoc->name; |
|
707 | - } elseif ($contact['source']=='external') { |
|
708 | - $objectdetail=new Contact($this->db); |
|
706 | + $contact['socname'] = $mysoc->name; |
|
707 | + } elseif ($contact['source'] == 'external') { |
|
708 | + $objectdetail = new Contact($this->db); |
|
709 | 709 | $objectdetail->fetch($contact['id']); |
710 | 710 | |
711 | - $soc=new Societe($this->db); |
|
711 | + $soc = new Societe($this->db); |
|
712 | 712 | $soc->fetch($contact['socid']); |
713 | - $contact['socname']=$soc->name; |
|
713 | + $contact['socname'] = $soc->name; |
|
714 | 714 | } |
715 | - $contact['fullname']=$objectdetail->getFullName($outputlangs,1); |
|
715 | + $contact['fullname'] = $objectdetail->getFullName($outputlangs, 1); |
|
716 | 716 | |
717 | - $tmparray=$this->get_substitutionarray_tasksressource($contact,$outputlangs); |
|
717 | + $tmparray = $this->get_substitutionarray_tasksressource($contact, $outputlangs); |
|
718 | 718 | |
719 | - foreach($tmparray as $key => $val) |
|
719 | + foreach ($tmparray as $key => $val) |
|
720 | 720 | { |
721 | 721 | try |
722 | 722 | { |
723 | 723 | $listlinestaskres->setVars($key, $val, true, 'UTF-8'); |
724 | 724 | } |
725 | - catch(OdfException $e) |
|
725 | + catch (OdfException $e) |
|
726 | 726 | { |
727 | 727 | dol_syslog($e->getMessage(), LOG_INFO); |
728 | 728 | } |
729 | - catch(SegmentException $e) |
|
729 | + catch (SegmentException $e) |
|
730 | 730 | { |
731 | 731 | dol_syslog($e->getMessage(), LOG_INFO); |
732 | 732 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | |
738 | 738 | //Time ressources |
739 | 739 | $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; |
740 | - $sql.= ", u.lastname, u.firstname, t.thm"; |
|
740 | + $sql .= ", u.lastname, u.firstname, t.thm"; |
|
741 | 741 | $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; |
742 | 742 | $sql .= " , ".MAIN_DB_PREFIX."user as u"; |
743 | 743 | $sql .= " WHERE t.fk_task =".$task->id; |
@@ -750,33 +750,33 @@ discard block |
||
750 | 750 | $num = $this->db->num_rows($resql); |
751 | 751 | $i = 0; |
752 | 752 | $tasks = array(); |
753 | - $row=array(); |
|
753 | + $row = array(); |
|
754 | 754 | $listlinestasktime = $listlines->__get('taskstimes'); |
755 | 755 | if (empty($num)) { |
756 | - $row['rowid']=''; |
|
757 | - $row['task_date']=''; |
|
758 | - $row['task_duration']=''; |
|
759 | - $row['$tasktime']=''; |
|
760 | - $row['note']=''; |
|
761 | - $row['fk_user']=''; |
|
762 | - $row['name']=''; |
|
763 | - $row['firstname']=''; |
|
764 | - $row['fullcivname']=''; |
|
765 | - $row['amountht']=''; |
|
766 | - $row['amountttc']=''; |
|
767 | - $row['thm']=''; |
|
768 | - $tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs); |
|
769 | - foreach($tmparray as $key => $val) |
|
756 | + $row['rowid'] = ''; |
|
757 | + $row['task_date'] = ''; |
|
758 | + $row['task_duration'] = ''; |
|
759 | + $row['$tasktime'] = ''; |
|
760 | + $row['note'] = ''; |
|
761 | + $row['fk_user'] = ''; |
|
762 | + $row['name'] = ''; |
|
763 | + $row['firstname'] = ''; |
|
764 | + $row['fullcivname'] = ''; |
|
765 | + $row['amountht'] = ''; |
|
766 | + $row['amountttc'] = ''; |
|
767 | + $row['thm'] = ''; |
|
768 | + $tmparray = $this->get_substitutionarray_taskstime($row, $outputlangs); |
|
769 | + foreach ($tmparray as $key => $val) |
|
770 | 770 | { |
771 | 771 | try |
772 | 772 | { |
773 | 773 | $listlinestasktime->setVars($key, $val, true, 'UTF-8'); |
774 | 774 | } |
775 | - catch(OdfException $e) |
|
775 | + catch (OdfException $e) |
|
776 | 776 | { |
777 | 777 | dol_syslog($e->getMessage(), LOG_INFO); |
778 | 778 | } |
779 | - catch(SegmentException $e) |
|
779 | + catch (SegmentException $e) |
|
780 | 780 | { |
781 | 781 | dol_syslog($e->getMessage(), LOG_INFO); |
782 | 782 | } |
@@ -787,36 +787,36 @@ discard block |
||
787 | 787 | { |
788 | 788 | $row = $this->db->fetch_array($resql); |
789 | 789 | if (!empty($row['fk_user'])) { |
790 | - $objectdetail=new User($this->db); |
|
790 | + $objectdetail = new User($this->db); |
|
791 | 791 | $objectdetail->fetch($row['fk_user']); |
792 | - $row['fullcivname']=$objectdetail->getFullName($outputlangs,1); |
|
792 | + $row['fullcivname'] = $objectdetail->getFullName($outputlangs, 1); |
|
793 | 793 | } else { |
794 | - $row['fullcivname']=''; |
|
794 | + $row['fullcivname'] = ''; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | if (!empty($row['thm'])) { |
798 | - $row['amountht']=($row['task_duration'] / 3600) * $row['thm']; |
|
798 | + $row['amountht'] = ($row['task_duration'] / 3600) * $row['thm']; |
|
799 | 799 | $defaultvat = get_default_tva($mysoc, $mysoc); |
800 | - $row['amountttc']=price2num($row['amountht'] * (1 + ($defaultvat / 100)),'MT'); |
|
800 | + $row['amountttc'] = price2num($row['amountht'] * (1 + ($defaultvat / 100)), 'MT'); |
|
801 | 801 | } else { |
802 | - $row['amountht']=0; |
|
803 | - $row['amountttc']=0; |
|
804 | - $row['thm']=0; |
|
802 | + $row['amountht'] = 0; |
|
803 | + $row['amountttc'] = 0; |
|
804 | + $row['thm'] = 0; |
|
805 | 805 | } |
806 | 806 | |
807 | - $tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs); |
|
807 | + $tmparray = $this->get_substitutionarray_taskstime($row, $outputlangs); |
|
808 | 808 | |
809 | - foreach($tmparray as $key => $val) |
|
809 | + foreach ($tmparray as $key => $val) |
|
810 | 810 | { |
811 | 811 | try |
812 | 812 | { |
813 | 813 | $listlinestasktime->setVars($key, $val, true, 'UTF-8'); |
814 | 814 | } |
815 | - catch(OdfException $e) |
|
815 | + catch (OdfException $e) |
|
816 | 816 | { |
817 | 817 | dol_syslog($e->getMessage(), LOG_INFO); |
818 | 818 | } |
819 | - catch(SegmentException $e) |
|
819 | + catch (SegmentException $e) |
|
820 | 820 | { |
821 | 821 | dol_syslog($e->getMessage(), LOG_INFO); |
822 | 822 | } |
@@ -832,14 +832,14 @@ discard block |
||
832 | 832 | $listtasksfiles = $listlines->__get('tasksfiles'); |
833 | 833 | |
834 | 834 | $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref); |
835 | - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1); |
|
835 | + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); |
|
836 | 836 | |
837 | 837 | |
838 | 838 | foreach ($filearray as $filedetail) |
839 | 839 | { |
840 | - $tmparray=$this->get_substitutionarray_task_file($filedetail,$outputlangs); |
|
840 | + $tmparray = $this->get_substitutionarray_task_file($filedetail, $outputlangs); |
|
841 | 841 | //dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true)); |
842 | - foreach($tmparray as $key => $val) |
|
842 | + foreach ($tmparray as $key => $val) |
|
843 | 843 | { |
844 | 844 | try |
845 | 845 | { |
@@ -860,13 +860,13 @@ discard block |
||
860 | 860 | } |
861 | 861 | $odfHandler->mergeSegment($listlines); |
862 | 862 | } |
863 | - catch(OdfException $e) |
|
863 | + catch (OdfException $e) |
|
864 | 864 | { |
865 | - $ExceptionTrace=$e->getTrace(); |
|
865 | + $ExceptionTrace = $e->getTrace(); |
|
866 | 866 | // no segment defined on ODT is not an error |
867 | - if($ExceptionTrace[0]['function'] != 'setSegment') |
|
867 | + if ($ExceptionTrace[0]['function'] != 'setSegment') |
|
868 | 868 | { |
869 | - $this->error=$e->getMessage(); |
|
869 | + $this->error = $e->getMessage(); |
|
870 | 870 | dol_syslog($this->error, LOG_WARNING); |
871 | 871 | return -1; |
872 | 872 | } |
@@ -878,24 +878,24 @@ discard block |
||
878 | 878 | $listlines = $odfHandler->setSegment('projectfiles'); |
879 | 879 | |
880 | 880 | $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); |
881 | - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1); |
|
881 | + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); |
|
882 | 882 | |
883 | 883 | foreach ($filearray as $filedetail) |
884 | 884 | { |
885 | 885 | //dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true)); |
886 | - $tmparray=$this->get_substitutionarray_project_file($filedetail,$outputlangs); |
|
886 | + $tmparray = $this->get_substitutionarray_project_file($filedetail, $outputlangs); |
|
887 | 887 | |
888 | - foreach($tmparray as $key => $val) |
|
888 | + foreach ($tmparray as $key => $val) |
|
889 | 889 | { |
890 | 890 | try |
891 | 891 | { |
892 | 892 | $listlines->setVars($key, $val, true, 'UTF-8'); |
893 | 893 | } |
894 | - catch(OdfException $e) |
|
894 | + catch (OdfException $e) |
|
895 | 895 | { |
896 | 896 | dol_syslog($e->getMessage(), LOG_INFO); |
897 | 897 | } |
898 | - catch(SegmentException $e) |
|
898 | + catch (SegmentException $e) |
|
899 | 899 | { |
900 | 900 | dol_syslog($e->getMessage(), LOG_INFO); |
901 | 901 | } |
@@ -904,21 +904,21 @@ discard block |
||
904 | 904 | } |
905 | 905 | $odfHandler->mergeSegment($listlines); |
906 | 906 | } |
907 | - catch(OdfException $e) |
|
907 | + catch (OdfException $e) |
|
908 | 908 | { |
909 | - $this->error=$e->getMessage(); |
|
909 | + $this->error = $e->getMessage(); |
|
910 | 910 | dol_syslog($this->error, LOG_WARNING); |
911 | 911 | return -1; |
912 | 912 | } |
913 | 913 | |
914 | 914 | // Replace tags of lines for contacts |
915 | - $sourcearray=array('internal','external'); |
|
916 | - $contact_arrray=array(); |
|
915 | + $sourcearray = array('internal', 'external'); |
|
916 | + $contact_arrray = array(); |
|
917 | 917 | foreach ($sourcearray as $source) { |
918 | - $contact_temp=$object->liste_contact(-1,$source); |
|
918 | + $contact_temp = $object->liste_contact(-1, $source); |
|
919 | 919 | if ((is_array($contact_temp) && count($contact_temp) > 0)) |
920 | 920 | { |
921 | - $contact_arrray=array_merge($contact_arrray,$contact_temp); |
|
921 | + $contact_arrray = array_merge($contact_arrray, $contact_temp); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | if ((is_array($contact_arrray) && count($contact_arrray) > 0)) |
@@ -929,32 +929,32 @@ discard block |
||
929 | 929 | |
930 | 930 | foreach ($contact_arrray as $contact) |
931 | 931 | { |
932 | - if ($contact['source']=='internal') { |
|
933 | - $objectdetail=new User($this->db); |
|
932 | + if ($contact['source'] == 'internal') { |
|
933 | + $objectdetail = new User($this->db); |
|
934 | 934 | $objectdetail->fetch($contact['id']); |
935 | - $contact['socname']=$mysoc->name; |
|
936 | - } elseif ($contact['source']=='external') { |
|
937 | - $objectdetail=new Contact($this->db); |
|
935 | + $contact['socname'] = $mysoc->name; |
|
936 | + } elseif ($contact['source'] == 'external') { |
|
937 | + $objectdetail = new Contact($this->db); |
|
938 | 938 | $objectdetail->fetch($contact['id']); |
939 | 939 | |
940 | - $soc=new Societe($this->db); |
|
940 | + $soc = new Societe($this->db); |
|
941 | 941 | $soc->fetch($contact['socid']); |
942 | - $contact['socname']=$soc->name; |
|
942 | + $contact['socname'] = $soc->name; |
|
943 | 943 | } |
944 | - $contact['fullname']=$objectdetail->getFullName($outputlangs,1); |
|
944 | + $contact['fullname'] = $objectdetail->getFullName($outputlangs, 1); |
|
945 | 945 | |
946 | - $tmparray=$this->get_substitutionarray_project_contacts($contact,$outputlangs); |
|
947 | - foreach($tmparray as $key => $val) |
|
946 | + $tmparray = $this->get_substitutionarray_project_contacts($contact, $outputlangs); |
|
947 | + foreach ($tmparray as $key => $val) |
|
948 | 948 | { |
949 | 949 | try |
950 | 950 | { |
951 | 951 | $listlines->setVars($key, $val, true, 'UTF-8'); |
952 | 952 | } |
953 | - catch(OdfException $e) |
|
953 | + catch (OdfException $e) |
|
954 | 954 | { |
955 | 955 | dol_syslog($e->getMessage(), LOG_INFO); |
956 | 956 | } |
957 | - catch(SegmentException $e) |
|
957 | + catch (SegmentException $e) |
|
958 | 958 | { |
959 | 959 | dol_syslog($e->getMessage(), LOG_INFO); |
960 | 960 | } |
@@ -963,9 +963,9 @@ discard block |
||
963 | 963 | } |
964 | 964 | $odfHandler->mergeSegment($listlines); |
965 | 965 | } |
966 | - catch(OdfException $e) |
|
966 | + catch (OdfException $e) |
|
967 | 967 | { |
968 | - $this->error=$e->getMessage(); |
|
968 | + $this->error = $e->getMessage(); |
|
969 | 969 | dol_syslog($this->error, LOG_WARNING); |
970 | 970 | return -1; |
971 | 971 | } |
@@ -1065,14 +1065,14 @@ discard block |
||
1065 | 1065 | 'title' => "ListSocialContributionAssociatedProject", |
1066 | 1066 | 'class' => 'ChargeSociales', |
1067 | 1067 | 'table' => 'chargesociales', |
1068 | - 'urlnew' => DOL_URL_ROOT . '/compta/sociales/card.php?action=create&projectid=' . $object->id, |
|
1068 | + 'urlnew' => DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$object->id, |
|
1069 | 1069 | 'test' => $conf->tax->enabled && $user->rights->tax->charges->lire |
1070 | 1070 | ), |
1071 | 1071 | 'stock_mouvement' => array( |
1072 | 1072 | 'title' => "ListMouvementStockProject", |
1073 | 1073 | 'class' => 'MouvementStock', |
1074 | 1074 | 'table' => 'stock_mouvement', |
1075 | - 'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)) |
|
1075 | + 'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)) |
|
1076 | 1076 | ), |
1077 | 1077 | 'agenda' => array( |
1078 | 1078 | 'title' => "ListActionsAssociatedProject", |
@@ -1090,72 +1090,72 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | foreach ($listofreferent as $keyref => $valueref) |
1092 | 1092 | { |
1093 | - $title=$valueref['title']; |
|
1094 | - $tablename=$valueref['table']; |
|
1095 | - $classname=$valueref['class']; |
|
1096 | - $qualified=$valueref['test']; |
|
1093 | + $title = $valueref['title']; |
|
1094 | + $tablename = $valueref['table']; |
|
1095 | + $classname = $valueref['class']; |
|
1096 | + $qualified = $valueref['test']; |
|
1097 | 1097 | if ($qualified) |
1098 | 1098 | { |
1099 | 1099 | $elementarray = $object->get_element_list($keyref, $tablename); |
1100 | - if (count($elementarray)>0 && is_array($elementarray)) |
|
1100 | + if (count($elementarray) > 0 && is_array($elementarray)) |
|
1101 | 1101 | { |
1102 | 1102 | $total_ht = 0; |
1103 | 1103 | $total_ttc = 0; |
1104 | - $num=count($elementarray); |
|
1104 | + $num = count($elementarray); |
|
1105 | 1105 | for ($i = 0; $i < $num; $i++) |
1106 | 1106 | { |
1107 | - $ref_array=array(); |
|
1108 | - $ref_array['type']=$langs->trans($classname); |
|
1107 | + $ref_array = array(); |
|
1108 | + $ref_array['type'] = $langs->trans($classname); |
|
1109 | 1109 | |
1110 | 1110 | $element = new $classname($this->db); |
1111 | 1111 | $element->fetch($elementarray[$i]); |
1112 | 1112 | $element->fetch_thirdparty(); |
1113 | 1113 | |
1114 | 1114 | //Ref object |
1115 | - $ref_array['ref']=$element->ref; |
|
1115 | + $ref_array['ref'] = $element->ref; |
|
1116 | 1116 | |
1117 | 1117 | //Date object |
1118 | - $dateref=$element->date; |
|
1119 | - if (empty($dateref)) $dateref=$element->datep; |
|
1120 | - if (empty($dateref)) $dateref=$element->date_contrat; |
|
1121 | - $ref_array['date']=$dateref; |
|
1118 | + $dateref = $element->date; |
|
1119 | + if (empty($dateref)) $dateref = $element->datep; |
|
1120 | + if (empty($dateref)) $dateref = $element->date_contrat; |
|
1121 | + $ref_array['date'] = $dateref; |
|
1122 | 1122 | |
1123 | 1123 | //Soc object |
1124 | 1124 | if (is_object($element->thirdparty)) { |
1125 | - $ref_array['socname']=$element->thirdparty->name; |
|
1125 | + $ref_array['socname'] = $element->thirdparty->name; |
|
1126 | 1126 | } else { |
1127 | - $ref_array['socname']=''; |
|
1127 | + $ref_array['socname'] = ''; |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | //Amount object |
1131 | 1131 | if (empty($valueref['disableamount'])) { |
1132 | 1132 | if (!empty($element->total_ht)) { |
1133 | - $ref_array['amountht']=$element->total_ht; |
|
1134 | - $ref_array['amountttc']=$element->total_ttc; |
|
1133 | + $ref_array['amountht'] = $element->total_ht; |
|
1134 | + $ref_array['amountttc'] = $element->total_ttc; |
|
1135 | 1135 | } else { |
1136 | - $ref_array['amountht']=0; |
|
1137 | - $ref_array['amountttc']=0; |
|
1136 | + $ref_array['amountht'] = 0; |
|
1137 | + $ref_array['amountttc'] = 0; |
|
1138 | 1138 | } |
1139 | 1139 | } else { |
1140 | - $ref_array['amountht']=''; |
|
1141 | - $ref_array['amountttc']=''; |
|
1140 | + $ref_array['amountht'] = ''; |
|
1141 | + $ref_array['amountttc'] = ''; |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | - $ref_array['status']=$element->getLibStatut(0); |
|
1144 | + $ref_array['status'] = $element->getLibStatut(0); |
|
1145 | 1145 | |
1146 | - $tmparray=$this->get_substitutionarray_project_reference($ref_array,$outputlangs); |
|
1146 | + $tmparray = $this->get_substitutionarray_project_reference($ref_array, $outputlangs); |
|
1147 | 1147 | |
1148 | - foreach($tmparray as $key => $val) |
|
1148 | + foreach ($tmparray as $key => $val) |
|
1149 | 1149 | { |
1150 | 1150 | try |
1151 | 1151 | { |
1152 | 1152 | $listlines->setVars($key, $val, true, 'UTF-8'); |
1153 | 1153 | } |
1154 | - catch(OdfException $e) |
|
1154 | + catch (OdfException $e) |
|
1155 | 1155 | { |
1156 | 1156 | dol_syslog($e->getMessage(), LOG_INFO); |
1157 | 1157 | } |
1158 | - catch(SegmentException $e) |
|
1158 | + catch (SegmentException $e) |
|
1159 | 1159 | { |
1160 | 1160 | dol_syslog($e->getMessage(), LOG_INFO); |
1161 | 1161 | } |
@@ -1166,15 +1166,15 @@ discard block |
||
1166 | 1166 | } |
1167 | 1167 | $odfHandler->mergeSegment($listlines); |
1168 | 1168 | } |
1169 | - } catch(OdfException $e) { |
|
1170 | - $this->error=$e->getMessage(); |
|
1169 | + } catch (OdfException $e) { |
|
1170 | + $this->error = $e->getMessage(); |
|
1171 | 1171 | dol_syslog($this->error, LOG_WARNING); |
1172 | 1172 | return -1; |
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | // Replace labels translated |
1176 | - $tmparray=$outputlangs->get_translations_for_substitutions(); |
|
1177 | - foreach($tmparray as $key=>$value) |
|
1176 | + $tmparray = $outputlangs->get_translations_for_substitutions(); |
|
1177 | + foreach ($tmparray as $key=>$value) |
|
1178 | 1178 | { |
1179 | 1179 | try { |
1180 | 1180 | $odfHandler->setVars($key, $value, true, 'UTF-8'); |
@@ -1184,8 +1184,8 @@ discard block |
||
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | // Call the beforeODTSave hook |
1187 | - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); |
|
1188 | - $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
1187 | + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); |
|
1188 | + $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
1189 | 1189 | |
1190 | 1190 | |
1191 | 1191 | // Write new file |
@@ -1193,33 +1193,33 @@ discard block |
||
1193 | 1193 | try { |
1194 | 1194 | $odfHandler->exportAsAttachedPDF($file); |
1195 | 1195 | } catch (Exception $e) { |
1196 | - $this->error=$e->getMessage(); |
|
1196 | + $this->error = $e->getMessage(); |
|
1197 | 1197 | return -1; |
1198 | 1198 | } |
1199 | 1199 | } else { |
1200 | 1200 | try { |
1201 | 1201 | $odfHandler->saveToDisk($file); |
1202 | - } catch (Exception $e){ |
|
1203 | - $this->error=$e->getMessage(); |
|
1202 | + } catch (Exception $e) { |
|
1203 | + $this->error = $e->getMessage(); |
|
1204 | 1204 | dol_syslog($e->getMessage(), LOG_INFO); |
1205 | 1205 | return -1; |
1206 | 1206 | } |
1207 | 1207 | } |
1208 | - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); |
|
1209 | - $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
1208 | + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); |
|
1209 | + $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
1210 | 1210 | |
1211 | - if (! empty($conf->global->MAIN_UMASK)) |
|
1211 | + if (!empty($conf->global->MAIN_UMASK)) |
|
1212 | 1212 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
1213 | 1213 | |
1214 | - $odfHandler=null; // Destroy object |
|
1214 | + $odfHandler = null; // Destroy object |
|
1215 | 1215 | |
1216 | 1216 | $this->result = array('fullpath'=>$file); |
1217 | 1217 | |
1218 | - return 1; // Success |
|
1218 | + return 1; // Success |
|
1219 | 1219 | } |
1220 | 1220 | else |
1221 | 1221 | { |
1222 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
1222 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
1223 | 1223 | return -1; |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var string Error code (or message) |
36 | 36 | */ |
37 | - public $error=''; |
|
37 | + public $error = ''; |
|
38 | 38 | |
39 | 39 | |
40 | 40 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | * @param integer $maxfilenamelength Max length of value to show |
46 | 46 | * @return array List of templates |
47 | 47 | */ |
48 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
48 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
49 | 49 | { |
50 | 50 | // phpcs:enable |
51 | 51 | global $conf; |
52 | 52 | |
53 | - $type='project'; |
|
54 | - $liste=array(); |
|
53 | + $type = 'project'; |
|
54 | + $liste = array(); |
|
55 | 55 | |
56 | 56 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
57 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
57 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
58 | 58 | |
59 | 59 | return $liste; |
60 | 60 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * @var string Error code (or message) |
72 | 72 | */ |
73 | - public $error=''; |
|
73 | + public $error = ''; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Return if a module can be used or not |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \brief File with class to manage the numbering module Simple for project references |
24 | 24 | */ |
25 | 25 | |
26 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/project/modules_project.php'; |
|
26 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -35,26 +35,26 @@ discard block |
||
35 | 35 | * Dolibarr version of the loaded document |
36 | 36 | * @public string |
37 | 37 | */ |
38 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
38 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
39 | 39 | |
40 | - public $prefix='PJ'; |
|
40 | + public $prefix = 'PJ'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @var string Error code (or message) |
44 | 44 | */ |
45 | - public $error=''; |
|
45 | + public $error = ''; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @var string Nom du modele |
49 | 49 | * @deprecated |
50 | 50 | * @see name |
51 | 51 | */ |
52 | - public $nom='Simple'; |
|
52 | + public $nom = 'Simple'; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @var string model name |
56 | 56 | */ |
57 | - public $name='Simple'; |
|
57 | + public $name = 'Simple'; |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | function info() |
66 | 66 | { |
67 | 67 | global $langs; |
68 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
68 | + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -87,29 +87,29 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function canBeActivated() |
89 | 89 | { |
90 | - global $conf,$langs,$db; |
|
90 | + global $conf, $langs, $db; |
|
91 | 91 | |
92 | - $coyymm=''; $max=''; |
|
92 | + $coyymm = ''; $max = ''; |
|
93 | 93 | |
94 | - $posindice=8; |
|
94 | + $posindice = 8; |
|
95 | 95 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
96 | - $sql.= " FROM ".MAIN_DB_PREFIX."projet"; |
|
97 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | - $sql.= " AND entity = ".$conf->entity; |
|
99 | - $resql=$db->query($sql); |
|
96 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet"; |
|
97 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | + $sql .= " AND entity = ".$conf->entity; |
|
99 | + $resql = $db->query($sql); |
|
100 | 100 | if ($resql) |
101 | 101 | { |
102 | 102 | $row = $db->fetch_row($resql); |
103 | - if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; } |
|
103 | + if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; } |
|
104 | 104 | } |
105 | - if (! $coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm)) |
|
105 | + if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) |
|
106 | 106 | { |
107 | 107 | return true; |
108 | 108 | } |
109 | 109 | else |
110 | 110 | { |
111 | 111 | $langs->load("errors"); |
112 | - $this->error=$langs->trans('ErrorNumRefModel',$max); |
|
112 | + $this->error = $langs->trans('ErrorNumRefModel', $max); |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | } |
@@ -124,21 +124,21 @@ discard block |
||
124 | 124 | */ |
125 | 125 | function getNextValue($objsoc, $project) |
126 | 126 | { |
127 | - global $db,$conf; |
|
127 | + global $db, $conf; |
|
128 | 128 | |
129 | 129 | // D'abord on recupere la valeur max |
130 | - $posindice=8; |
|
130 | + $posindice = 8; |
|
131 | 131 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
132 | - $sql.= " FROM ".MAIN_DB_PREFIX."projet"; |
|
133 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
134 | - $sql.= " AND entity = ".$conf->entity; |
|
132 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet"; |
|
133 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
134 | + $sql .= " AND entity = ".$conf->entity; |
|
135 | 135 | |
136 | - $resql=$db->query($sql); |
|
136 | + $resql = $db->query($sql); |
|
137 | 137 | if ($resql) |
138 | 138 | { |
139 | 139 | $obj = $db->fetch_object($resql); |
140 | 140 | if ($obj) $max = intval($obj->max); |
141 | - else $max=0; |
|
141 | + else $max = 0; |
|
142 | 142 | } |
143 | 143 | else |
144 | 144 | { |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | return -1; |
147 | 147 | } |
148 | 148 | |
149 | - $date=empty($project->date_c)?dol_now():$project->date_c; |
|
149 | + $date = empty($project->date_c) ?dol_now() : $project->date_c; |
|
150 | 150 | |
151 | 151 | //$yymm = strftime("%y%m",time()); |
152 | - $yymm = strftime("%y%m",$date); |
|
152 | + $yymm = strftime("%y%m", $date); |
|
153 | 153 | |
154 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
155 | - else $num = sprintf("%04s",$max+1); |
|
154 | + if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
155 | + else $num = sprintf("%04s", $max + 1); |
|
156 | 156 | |
157 | 157 | dol_syslog("mod_project_simple::getNextValue return ".$this->prefix.$yymm."-".$num); |
158 | 158 | return $this->prefix.$yymm."-".$num; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param Project $project Object project |
168 | 168 | * @return string Next not used reference |
169 | 169 | */ |
170 | - function project_get_num($objsoc=0, $project='') |
|
170 | + function project_get_num($objsoc = 0, $project = '') |
|
171 | 171 | { |
172 | 172 | // phpcs:enable |
173 | 173 | return $this->getNextValue($objsoc, $project); |