Passed
Push — master ( a56e33...222e44 )
by Alxarafe
36:56
created
dolibarr/htdocs/core/modules/fichinter/mod_arctic.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -32,68 +32,68 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class mod_arctic extends ModeleNumRefFicheinter
34 34
 {
35
-	/**
35
+    /**
36 36
      * Dolibarr version of the loaded document
37 37
      * @public string
38 38
      */
39
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
39
+    public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
40 40
 
41
-	/**
42
-	 * @var string Error message
43
-	 */
44
-	public $error = '';
41
+    /**
42
+     * @var string Error message
43
+     */
44
+    public $error = '';
45 45
 
46
-	/**
47
-	 * @var string Nom du modele
48
-	 * @deprecated
49
-	 * @see name
50
-	 */
51
-	public $nom='arctic';
46
+    /**
47
+     * @var string Nom du modele
48
+     * @deprecated
49
+     * @see name
50
+     */
51
+    public $nom='arctic';
52 52
 
53
-	/**
54
-	 * @var string model name
55
-	 */
56
-	public $name='arctic';
53
+    /**
54
+     * @var string model name
55
+     */
56
+    public $name='arctic';
57 57
 
58 58
 
59
-	/**
59
+    /**
60 60
      *  Renvoi la description du modele de numerotation
61 61
      *
62 62
      *  @return     string      Texte descripif
63 63
      */
64
-	function info()
64
+    function info()
65 65
     {
66
-    	global $conf, $langs;
66
+        global $conf, $langs;
67 67
 
68
-		$langs->load("bills");
68
+        $langs->load("bills");
69 69
 
70
-		$form = new Form($this->db);
70
+        $form = new Form($this->db);
71 71
 
72
-		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
73
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
74
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
75
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
76
-		$texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
77
-		$texte.= '<table class="nobordernopadding" width="100%">';
72
+        $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
73
+        $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
74
+        $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
75
+        $texte.= '<input type="hidden" name="action" value="updateMask">';
76
+        $texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
77
+        $texte.= '<table class="nobordernopadding" width="100%">';
78 78
 
79
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
80
-		$tooltip.=$langs->trans("GenericMaskCodes2");
81
-		$tooltip.=$langs->trans("GenericMaskCodes3");
82
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
83
-		$tooltip.=$langs->trans("GenericMaskCodes5");
79
+        $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
80
+        $tooltip.=$langs->trans("GenericMaskCodes2");
81
+        $tooltip.=$langs->trans("GenericMaskCodes3");
82
+        $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
83
+        $tooltip.=$langs->trans("GenericMaskCodes5");
84 84
 
85
-		// Parametrage du prefix
86
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
87
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>';
85
+        // Parametrage du prefix
86
+        $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
87
+        $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>';
88 88
 
89
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
89
+        $texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
90 90
 
91
-		$texte.= '</tr>';
91
+        $texte.= '</tr>';
92 92
 
93
-		$texte.= '</table>';
94
-		$texte.= '</form>';
93
+        $texte.= '</table>';
94
+        $texte.= '</form>';
95 95
 
96
-		return $texte;
96
+        return $texte;
97 97
     }
98 98
 
99 99
     /**
@@ -103,53 +103,53 @@  discard block
 block discarded – undo
103 103
      */
104 104
     function getExample()
105 105
     {
106
-     	global $conf,$langs,$mysoc;
107
-
108
-    	$old_code_client=$mysoc->code_client;
109
-    	$mysoc->code_client='CCCCCCCCCC';
110
-     	$numExample = $this->getNextValue($mysoc,'');
111
-		$mysoc->code_client=$old_code_client;
112
-
113
-		if (! $numExample)
114
-		{
115
-			$numExample = $langs->trans('NotConfigured');
116
-		}
117
-		return $numExample;
106
+            global $conf,$langs,$mysoc;
107
+
108
+        $old_code_client=$mysoc->code_client;
109
+        $mysoc->code_client='CCCCCCCCCC';
110
+            $numExample = $this->getNextValue($mysoc,'');
111
+        $mysoc->code_client=$old_code_client;
112
+
113
+        if (! $numExample)
114
+        {
115
+            $numExample = $langs->trans('NotConfigured');
116
+        }
117
+        return $numExample;
118 118
     }
119 119
 
120
-	/**
121
-	 * 	Return next free value
122
-	 *
123
-	 *  @param	Societe		$objsoc     Object thirdparty
124
-	 *  @param  Object		$object		Object we need next value for
125
-	 *  @return string      			Value if KO, <0 if KO
126
-	 */
120
+    /**
121
+     * 	Return next free value
122
+     *
123
+     *  @param	Societe		$objsoc     Object thirdparty
124
+     *  @param  Object		$object		Object we need next value for
125
+     *  @return string      			Value if KO, <0 if KO
126
+     */
127 127
     function getNextValue($objsoc=0,$object='')
128 128
     {
129
-		global $db,$conf;
129
+        global $db,$conf;
130 130
 
131
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
131
+        require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
132 132
 
133
-		// On d�fini critere recherche compteur
134
-		$mask=$conf->global->FICHINTER_ARTIC_MASK;
133
+        // On d�fini critere recherche compteur
134
+        $mask=$conf->global->FICHINTER_ARTIC_MASK;
135 135
 
136
-		if (! $mask)
137
-		{
138
-			$this->error='NotConfigured';
139
-			return 0;
140
-		}
136
+        if (! $mask)
137
+        {
138
+            $this->error='NotConfigured';
139
+            return 0;
140
+        }
141 141
 
142
-		$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec);
142
+        $numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec);
143 143
 
144
-		return  $numFinal;
145
-  }
144
+        return  $numFinal;
145
+    }
146 146
 
147 147
 
148
-	/**
149
-	 * 	Return next free value
150
-	 *
148
+    /**
149
+     * 	Return next free value
150
+     *
151 151
      *  @param	Societe		$objsoc     Object third party
152
-	 * 	@param	Object		$objforref	Object for number to search
152
+     * 	@param	Object		$objforref	Object for number to search
153 153
      *  @return string      			Next free value
154 154
      */
155 155
     function getNumRef($objsoc,$objforref)
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *	\ingroup    fiche intervention
26 26
  *	\brief      File with Arctic numbering module for interventions
27 27
  */
28
-require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php';
28
+require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
29 29
 
30 30
 /**
31 31
  *	Class to manage numbering of intervention cards with rule Artic.
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * Dolibarr version of the loaded document
37 37
      * @public string
38 38
      */
39
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
39
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
40 40
 
41 41
 	/**
42 42
 	 * @var string Error message
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 	 * @deprecated
49 49
 	 * @see name
50 50
 	 */
51
-	public $nom='arctic';
51
+	public $nom = 'arctic';
52 52
 
53 53
 	/**
54 54
 	 * @var string model name
55 55
 	 */
56
-	public $name='arctic';
56
+	public $name = 'arctic';
57 57
 
58 58
 
59 59
 	/**
@@ -70,28 +70,28 @@  discard block
 block discarded – undo
70 70
 		$form = new Form($this->db);
71 71
 
72 72
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
73
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
74
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
75
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
76
-		$texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
77
-		$texte.= '<table class="nobordernopadding" width="100%">';
78
-
79
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
80
-		$tooltip.=$langs->trans("GenericMaskCodes2");
81
-		$tooltip.=$langs->trans("GenericMaskCodes3");
82
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
83
-		$tooltip.=$langs->trans("GenericMaskCodes5");
73
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
74
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
75
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
76
+		$texte .= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
77
+		$texte .= '<table class="nobordernopadding" width="100%">';
78
+
79
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
80
+		$tooltip .= $langs->trans("GenericMaskCodes2");
81
+		$tooltip .= $langs->trans("GenericMaskCodes3");
82
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
83
+		$tooltip .= $langs->trans("GenericMaskCodes5");
84 84
 
85 85
 		// Parametrage du prefix
86
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
87
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>';
86
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
87
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">', $tooltip, 1, 1).'</td>';
88 88
 
89
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
89
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
90 90
 
91
-		$texte.= '</tr>';
91
+		$texte .= '</tr>';
92 92
 
93
-		$texte.= '</table>';
94
-		$texte.= '</form>';
93
+		$texte .= '</table>';
94
+		$texte .= '</form>';
95 95
 
96 96
 		return $texte;
97 97
     }
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
      */
104 104
     function getExample()
105 105
     {
106
-     	global $conf,$langs,$mysoc;
106
+     	global $conf, $langs, $mysoc;
107 107
 
108
-    	$old_code_client=$mysoc->code_client;
109
-    	$mysoc->code_client='CCCCCCCCCC';
110
-     	$numExample = $this->getNextValue($mysoc,'');
111
-		$mysoc->code_client=$old_code_client;
108
+    	$old_code_client = $mysoc->code_client;
109
+    	$mysoc->code_client = 'CCCCCCCCCC';
110
+     	$numExample = $this->getNextValue($mysoc, '');
111
+		$mysoc->code_client = $old_code_client;
112 112
 
113
-		if (! $numExample)
113
+		if (!$numExample)
114 114
 		{
115 115
 			$numExample = $langs->trans('NotConfigured');
116 116
 		}
@@ -124,22 +124,22 @@  discard block
 block discarded – undo
124 124
 	 *  @param  Object		$object		Object we need next value for
125 125
 	 *  @return string      			Value if KO, <0 if KO
126 126
 	 */
127
-    function getNextValue($objsoc=0,$object='')
127
+    function getNextValue($objsoc = 0, $object = '')
128 128
     {
129
-		global $db,$conf;
129
+		global $db, $conf;
130 130
 
131
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
131
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
132 132
 
133 133
 		// On d�fini critere recherche compteur
134
-		$mask=$conf->global->FICHINTER_ARTIC_MASK;
134
+		$mask = $conf->global->FICHINTER_ARTIC_MASK;
135 135
 
136
-		if (! $mask)
136
+		if (!$mask)
137 137
 		{
138
-			$this->error='NotConfigured';
138
+			$this->error = 'NotConfigured';
139 139
 			return 0;
140 140
 		}
141 141
 
142
-		$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec);
142
+		$numFinal = get_next_value($db, $mask, 'fichinter', 'ref', '', $objsoc, $object->datec);
143 143
 
144 144
 		return  $numFinal;
145 145
   }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 * 	@param	Object		$objforref	Object for number to search
153 153
      *  @return string      			Next free value
154 154
      */
155
-    function getNumRef($objsoc,$objforref)
155
+    function getNumRef($objsoc, $objforref)
156 156
     {
157
-        return $this->getNextValue($objsoc,$objforref);
157
+        return $this->getNextValue($objsoc, $objforref);
158 158
     }
159 159
 }
160 160
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modExternalSite.class.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -35,84 +35,84 @@
 block discarded – undo
35 35
 {
36 36
 
37 37
     /**
38
-	 *   Constructor. Define names, constants, directories, boxes, permissions
39
-	 *
40
-	 *   @param      DoliDB		$db      Database handler
38
+     *   Constructor. Define names, constants, directories, boxes, permissions
39
+     *
40
+     *   @param      DoliDB		$db      Database handler
41 41
      */
42
-	function __construct($db)
43
-	{
44
-		$this->db = $db;
45
-
46
-		// Id for module (must be unique).
47
-		// Use here a free id.
48
-		$this->numero = 100;
49
-
50
-		// Family can be 'crm','financial','hr','projects','product','technic','other'
51
-		// It is used to sort modules in module setup page
52
-		$this->family = "interface";
53
-		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
54
-		$this->name = preg_replace('/^mod/i','',get_class($this));
55
-		// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
56
-		$this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame.";
57
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
58
-		$this->version = 'dolibarr';
59
-		// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
60
-		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
61
-		// Name of png file (without png) used for this module
62
-		$this->picto='bookmark';
63
-		// Call to inside lang's file
64
-		$this->langfiles = array("externalsite");
65
-
66
-		// Data directories to create when module is enabled
67
-		$this->dirs = array();
68
-
69
-		// Config pages. Put here list of php page names stored in admmin directory used to setup module
70
-		$this->config_page_url = array("externalsite.php@externalsite");
71
-
72
-		// Dependencies
73
-		$this->depends = array();		// List of modules id that must be enabled if this module is enabled
74
-		$this->requiredby = array();	// List of modules id to disable if this one is disabled
75
-
76
-		// Constants
77
-		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
78
-		// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
79
-		//                             1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0)
80
-		// );
81
-		$this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0));
82
-
83
-		// Boxes
84
-		$this->boxes = array();			// List of boxes
85
-		$r=0;
86
-
87
-		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
88
-		// Example:
42
+    function __construct($db)
43
+    {
44
+        $this->db = $db;
45
+
46
+        // Id for module (must be unique).
47
+        // Use here a free id.
48
+        $this->numero = 100;
49
+
50
+        // Family can be 'crm','financial','hr','projects','product','technic','other'
51
+        // It is used to sort modules in module setup page
52
+        $this->family = "interface";
53
+        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
54
+        $this->name = preg_replace('/^mod/i','',get_class($this));
55
+        // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
56
+        $this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame.";
57
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
58
+        $this->version = 'dolibarr';
59
+        // Key used in llx_const table to save module status enabled/disabled (XXX is id value)
60
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
61
+        // Name of png file (without png) used for this module
62
+        $this->picto='bookmark';
63
+        // Call to inside lang's file
64
+        $this->langfiles = array("externalsite");
65
+
66
+        // Data directories to create when module is enabled
67
+        $this->dirs = array();
68
+
69
+        // Config pages. Put here list of php page names stored in admmin directory used to setup module
70
+        $this->config_page_url = array("externalsite.php@externalsite");
71
+
72
+        // Dependencies
73
+        $this->depends = array();		// List of modules id that must be enabled if this module is enabled
74
+        $this->requiredby = array();	// List of modules id to disable if this one is disabled
75
+
76
+        // Constants
77
+        // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
78
+        // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
79
+        //                             1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0)
80
+        // );
81
+        $this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0));
82
+
83
+        // Boxes
84
+        $this->boxes = array();			// List of boxes
85
+        $r=0;
86
+
87
+        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
88
+        // Example:
89 89
         //$this->boxes[$r][1] = "myboxa.php";
90
-    	//$r++;
90
+        //$r++;
91 91
         //$this->boxes[$r][1] = "myboxb.php";
92
-    	//$r++;
92
+        //$r++;
93 93
 
94
-		// Permissions
95
-		$this->rights_class = 'externalsite';	// Permission key
96
-		$this->rights = array();		// Permission array used by this module
94
+        // Permissions
95
+        $this->rights_class = 'externalsite';	// Permission key
96
+        $this->rights = array();		// Permission array used by this module
97 97
 
98 98
         // Menus
99
-		//------
100
-		$r=0;
101
-
102
-		$this->menu[$r]=array(
103
-			'fk_menu'=>0,
104
-			'type'=>'top',
105
-			'titre'=>'__[EXTERNALSITE_LABEL]__',
106
-			'mainmenu'=>'externalsite',
107
-			'url'=>'/externalsite/frames.php',
108
-			'langs'=>'other',
109
-			'position'=>100,
110
-			'perms'=>'',
111
-			'enabled'=>'$conf->externalsite->enabled',
112
-			'target'=>'',
113
-			'user'=>0
114
-		);
115
-		$r++;
116
-	}
99
+        //------
100
+        $r=0;
101
+
102
+        $this->menu[$r]=array(
103
+            'fk_menu'=>0,
104
+            'type'=>'top',
105
+            'titre'=>'__[EXTERNALSITE_LABEL]__',
106
+            'mainmenu'=>'externalsite',
107
+            'url'=>'/externalsite/frames.php',
108
+            'langs'=>'other',
109
+            'position'=>100,
110
+            'perms'=>'',
111
+            'enabled'=>'$conf->externalsite->enabled',
112
+            'target'=>'',
113
+            'user'=>0
114
+        );
115
+        $r++;
116
+    }
117 117
 }
118 118
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * \brief      Description and activation file for module ExternalSite
26 26
  */
27 27
 
28
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
28
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29 29
 
30 30
 
31 31
 /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		// It is used to sort modules in module setup page
52 52
 		$this->family = "interface";
53 53
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
54
-		$this->name = preg_replace('/^mod/i','',get_class($this));
54
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
55 55
 		// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
56 56
 		$this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame.";
57 57
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
60 60
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
61 61
 		// Name of png file (without png) used for this module
62
-		$this->picto='bookmark';
62
+		$this->picto = 'bookmark';
63 63
 		// Call to inside lang's file
64 64
 		$this->langfiles = array("externalsite");
65 65
 
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
 		$this->config_page_url = array("externalsite.php@externalsite");
71 71
 
72 72
 		// Dependencies
73
-		$this->depends = array();		// List of modules id that must be enabled if this module is enabled
74
-		$this->requiredby = array();	// List of modules id to disable if this one is disabled
73
+		$this->depends = array(); // List of modules id that must be enabled if this module is enabled
74
+		$this->requiredby = array(); // List of modules id to disable if this one is disabled
75 75
 
76 76
 		// Constants
77 77
 		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
78 78
 		// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
79 79
 		//                             1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0)
80 80
 		// );
81
-		$this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0));
81
+		$this->const = array(0=>array('EXTERNALSITE_LABEL', 'chaine', 'ExternalSite', 'To declare label to use into external site menu entry', 0));
82 82
 
83 83
 		// Boxes
84
-		$this->boxes = array();			// List of boxes
85
-		$r=0;
84
+		$this->boxes = array(); // List of boxes
85
+		$r = 0;
86 86
 
87 87
 		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
88 88
 		// Example:
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
     	//$r++;
93 93
 
94 94
 		// Permissions
95
-		$this->rights_class = 'externalsite';	// Permission key
96
-		$this->rights = array();		// Permission array used by this module
95
+		$this->rights_class = 'externalsite'; // Permission key
96
+		$this->rights = array(); // Permission array used by this module
97 97
 
98 98
         // Menus
99 99
 		//------
100
-		$r=0;
100
+		$r = 0;
101 101
 
102
-		$this->menu[$r]=array(
102
+		$this->menu[$r] = array(
103 103
 			'fk_menu'=>0,
104 104
 			'type'=>'top',
105 105
 			'titre'=>'__[EXTERNALSITE_LABEL]__',
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/livraison/mod_livraison_jade.php 3 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -34,46 +34,46 @@  discard block
 block discarded – undo
34 34
 
35 35
 class mod_livraison_jade extends ModeleNumRefDeliveryOrder
36 36
 {
37
-	/**
37
+    /**
38 38
      * Dolibarr version of the loaded document
39 39
      * @public string
40 40
      */
41
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
41
+    public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
42 42
 
43
-	/**
44
-	 * @var string Error message
45
-	 */
46
-	public $error = '';
43
+    /**
44
+     * @var string Error message
45
+     */
46
+    public $error = '';
47 47
 
48
-	/**
49
-	 * @var string Nom du modele
50
-	 * @deprecated
51
-	 * @see name
52
-	 */
53
-	public $nom='Jade';
48
+    /**
49
+     * @var string Nom du modele
50
+     * @deprecated
51
+     * @see name
52
+     */
53
+    public $nom='Jade';
54 54
 
55
-	/**
56
-	 * @var string model name
57
-	 */
58
-	public $name='Jade';
55
+    /**
56
+     * @var string model name
57
+     */
58
+    public $name='Jade';
59 59
 
60 60
     public $prefix='BL';
61 61
 
62 62
 
63
-	/**
64
-	 *   Renvoi la description du modele de numerotation
65
-	 *
66
-	 *   @return     string      Texte descripif
67
-	 */
68
-	function info()
69
-	{
70
-		global $langs;
71
-		return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
72
-	}
73
-
74
-	/**
75
-	 *  Renvoi un exemple de numerotation
76
-	 *
63
+    /**
64
+     *   Renvoi la description du modele de numerotation
65
+     *
66
+     *   @return     string      Texte descripif
67
+     */
68
+    function info()
69
+    {
70
+        global $langs;
71
+        return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
72
+    }
73
+
74
+    /**
75
+     *  Renvoi un exemple de numerotation
76
+     *
77 77
      *  @return     string      Example
78 78
      */
79 79
     function getExample()
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
     }
120 120
 
121 121
     /**
122
-	 * 	Return next free value
123
-	 *
124
-	 *  @param	Societe		$objsoc     Object thirdparty
125
-	 *  @param  Object		$object		Object we need next value for
126
-	 *  @return string      			Value if KO, <0 if KO
127
-	 */
122
+     * 	Return next free value
123
+     *
124
+     *  @param	Societe		$objsoc     Object thirdparty
125
+     *  @param  Object		$object		Object we need next value for
126
+     *  @return string      			Value if KO, <0 if KO
127
+     */
128 128
     function getNextValue($objsoc,$object)
129 129
     {
130 130
         global $db,$conf;
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 
163 163
 
164 164
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
165
-	/**
166
-	 *  Return next free ref
167
-	 *
165
+    /**
166
+     *  Return next free ref
167
+     *
168 168
      *  @param  Societe		$objsoc      	Object thirdparty
169 169
      *  @param  Object		$object			Object livraison
170 170
      *  @return string      				Texte descriptif
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *   \brief      Fichier contenant la classe du modele de numerotation de reference de bon de livraison Jade
25 25
  */
26 26
 
27
-require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/modules_livraison.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php';
28 28
 
29 29
 
30 30
 /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * Dolibarr version of the loaded document
39 39
      * @public string
40 40
      */
41
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
41
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
42 42
 
43 43
 	/**
44 44
 	 * @var string Error message
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	 * @deprecated
51 51
 	 * @see name
52 52
 	 */
53
-	public $nom='Jade';
53
+	public $nom = 'Jade';
54 54
 
55 55
 	/**
56 56
 	 * @var string model name
57 57
 	 */
58
-	public $name='Jade';
58
+	public $name = 'Jade';
59 59
 
60
-    public $prefix='BL';
60
+    public $prefix = 'BL';
61 61
 
62 62
 
63 63
 	/**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	function info()
69 69
 	{
70 70
 		global $langs;
71
-		return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
71
+		return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
72 72
 	}
73 73
 
74 74
 	/**
@@ -89,29 +89,29 @@  discard block
 block discarded – undo
89 89
      */
90 90
     function canBeActivated()
91 91
     {
92
-        global $langs,$conf,$db;
92
+        global $langs, $conf, $db;
93 93
 
94 94
         $langs->load("bills");
95 95
 
96 96
         // Check invoice num
97
-        $fayymm=''; $max='';
97
+        $fayymm = ''; $max = '';
98 98
 
99
-        $posindice=8;
100
-        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";   // This is standard SQL
101
-        $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
102
-        $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
103
-        $sql.= " AND entity = ".$conf->entity;
99
+        $posindice = 8;
100
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
101
+        $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
102
+        $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
103
+        $sql .= " AND entity = ".$conf->entity;
104 104
 
105
-        $resql=$db->query($sql);
105
+        $resql = $db->query($sql);
106 106
         if ($resql)
107 107
         {
108 108
             $row = $db->fetch_row($resql);
109
-            if ($row) { $fayymm = substr($row[0],0,6); $max=$row[0]; }
109
+            if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; }
110 110
         }
111
-        if ($fayymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm))
111
+        if ($fayymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm))
112 112
         {
113 113
             $langs->load("errors");
114
-            $this->error=$langs->trans('ErrorNumRefModel',$max);
114
+            $this->error = $langs->trans('ErrorNumRefModel', $max);
115 115
             return false;
116 116
         }
117 117
 
@@ -125,36 +125,36 @@  discard block
 block discarded – undo
125 125
 	 *  @param  Object		$object		Object we need next value for
126 126
 	 *  @return string      			Value if KO, <0 if KO
127 127
 	 */
128
-    function getNextValue($objsoc,$object)
128
+    function getNextValue($objsoc, $object)
129 129
     {
130
-        global $db,$conf;
130
+        global $db, $conf;
131 131
 
132 132
         // D'abord on recupere la valeur max
133
-        $posindice=8;
134
-        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";   // This is standard SQL
135
-        $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
136
-        $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
137
-        $sql.= " AND entity = ".$conf->entity;
133
+        $posindice = 8;
134
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
135
+        $sql .= " FROM ".MAIN_DB_PREFIX."livraison";
136
+        $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
137
+        $sql .= " AND entity = ".$conf->entity;
138 138
 
139
-        $resql=$db->query($sql);
139
+        $resql = $db->query($sql);
140 140
         dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG);
141 141
         if ($resql)
142 142
         {
143 143
             $obj = $db->fetch_object($resql);
144 144
             if ($obj) $max = intval($obj->max);
145
-            else $max=0;
145
+            else $max = 0;
146 146
         }
147 147
         else
148 148
         {
149 149
             return -1;
150 150
         }
151 151
 
152
-        $date=$object->date_delivery;
153
-        if (empty($date)) $date=dol_now();
154
-        $yymm = strftime("%y%m",$date);
152
+        $date = $object->date_delivery;
153
+        if (empty($date)) $date = dol_now();
154
+        $yymm = strftime("%y%m", $date);
155 155
 
156
-        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
157
-        else $num = sprintf("%04s",$max+1);
156
+        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
157
+        else $num = sprintf("%04s", $max + 1);
158 158
 
159 159
         dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
160 160
         return $this->prefix.$yymm."-".$num;
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
      *  @param  Object		$object			Object livraison
170 170
      *  @return string      				Texte descriptif
171 171
      */
172
-    function livraison_get_num($objsoc=0,$object='')
172
+    function livraison_get_num($objsoc = 0, $object = '')
173 173
     {
174 174
         // phpcs:enable
175
-        return $this->getNextValue($objsoc,$object);
175
+        return $this->getNextValue($objsoc, $object);
176 176
     }
177 177
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -141,20 +141,29 @@
 block discarded – undo
141 141
         if ($resql)
142 142
         {
143 143
             $obj = $db->fetch_object($resql);
144
-            if ($obj) $max = intval($obj->max);
145
-            else $max=0;
146
-        }
147
-        else
144
+            if ($obj) {
145
+                $max = intval($obj->max);
146
+            } else {
147
+                $max=0;
148
+            }
149
+        } else
148 150
         {
149 151
             return -1;
150 152
         }
151 153
 
152 154
         $date=$object->date_delivery;
153
-        if (empty($date)) $date=dol_now();
155
+        if (empty($date)) {
156
+            $date=dol_now();
157
+        }
154 158
         $yymm = strftime("%y%m",$date);
155 159
 
156
-        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
157
-        else $num = sprintf("%04s",$max+1);
160
+        if ($max >= (pow(10, 4) - 1)) {
161
+            $num=$max+1;
162
+        }
163
+        // If counter > 9999, we do not format on 4 chars, we take number as it is
164
+        else {
165
+            $num = sprintf("%04s",$max+1);
166
+        }
158 167
 
159 168
         dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
160 169
         return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php 3 patches
Indentation   +645 added lines, -645 removed lines patch added patch discarded remove patch
@@ -39,139 +39,139 @@  discard block
 block discarded – undo
39 39
  */
40 40
 class pdf_typhon extends ModelePDFDeliveryOrder
41 41
 {
42
-	/**
42
+    /**
43 43
      * @var DoliDb Database handler
44 44
      */
45 45
     public $db;
46 46
 
47
-	/**
47
+    /**
48 48
      * @var string model name
49 49
      */
50 50
     public $name;
51 51
 
52
-	/**
52
+    /**
53 53
      * @var string model description (short text)
54 54
      */
55 55
     public $description;
56 56
 
57
-	/**
57
+    /**
58 58
      * @var string document type
59 59
      */
60 60
     public $type;
61 61
 
62 62
     /**
63 63
      * @var array() Minimum version of PHP required by module.
64
-	 * e.g.: PHP ≥ 5.4 = array(5, 4)
64
+     * e.g.: PHP ≥ 5.4 = array(5, 4)
65 65
      */
66
-	public $phpmin = array(5, 4);
66
+    public $phpmin = array(5, 4);
67 67
 
68
-	/**
68
+    /**
69 69
      * Dolibarr version of the loaded document
70 70
      * @public string
71 71
      */
72
-	public $version = 'dolibarr';
72
+    public $version = 'dolibarr';
73 73
 
74
-	/**
74
+    /**
75 75
      * @var int page_largeur
76 76
      */
77 77
     public $page_largeur;
78 78
 
79
-	/**
79
+    /**
80 80
      * @var int page_hauteur
81 81
      */
82 82
     public $page_hauteur;
83 83
 
84
-	/**
84
+    /**
85 85
      * @var array format
86 86
      */
87 87
     public $format;
88 88
 
89
-	/**
89
+    /**
90 90
      * @var int marge_gauche
91 91
      */
92
-	public $marge_gauche;
92
+    public $marge_gauche;
93 93
 
94
-	/**
94
+    /**
95 95
      * @var int marge_droite
96 96
      */
97
-	public $marge_droite;
97
+    public $marge_droite;
98 98
 
99
-	/**
99
+    /**
100 100
      * @var int marge_haute
101 101
      */
102
-	public $marge_haute;
102
+    public $marge_haute;
103 103
 
104
-	/**
104
+    /**
105 105
      * @var int marge_basse
106 106
      */
107
-	public $marge_basse;
108
-
109
-	/**
110
-	 * Issuer
111
-	 * @var Company object that emits
112
-	 */
113
-	public $emetteur;
114
-
115
-	/**
116
-	 *	Constructor
117
-	 *
118
-	 *  @param		DoliDB		$db      Database handler
119
-	 */
120
-	function __construct($db)
121
-	{
122
-		global $conf,$langs,$mysoc;
123
-
124
-		// Translations
125
-		$langs->loadLangs(array("main", "bills", "sendings", "companies"));
126
-
127
-		$this->db = $db;
128
-		$this->name = "typhon";
129
-		$this->description = $langs->trans("DocumentModelTyphon");
130
-
131
-		// Dimension page pour format A4
132
-		$this->type = 'pdf';
133
-		$formatarray=pdf_getFormat();
134
-		$this->page_largeur = $formatarray['width'];
135
-		$this->page_hauteur = $formatarray['height'];
136
-		$this->format = array($this->page_largeur,$this->page_hauteur);
137
-		$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
138
-		$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
139
-		$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
140
-		$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
141
-
142
-		$this->option_logo = 1;                    // Affiche logo FAC_PDF_LOGO
143
-		$this->option_tva = 1;                     // Gere option tva FACTURE_TVAOPTION
144
-		$this->option_codeproduitservice = 1;      // Affiche code produit-service
145
-
146
-		$this->franchise=!$mysoc->tva_assuj;
147
-
148
-		// Get source company
149
-		$this->emetteur=$mysoc;
150
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
151
-
152
-		// Define position of columns
153
-		$this->posxdesc=$this->marge_gauche+1;
154
-		$this->posxcomm=112;
155
-		//$this->posxtva=112;
156
-		//$this->posxup=126;
157
-		$this->posxqty=165;
158
-		$this->posxremainingqty=185;
159
-		//$this->posxdiscount=162;
160
-		//$this->postotalht=174;
161
-		if ($this->page_largeur < 210) // To work with US executive format
162
-		{
163
-			$this->posxcomm-=20;
164
-			//$this->posxtva-=20;
165
-			//$this->posxup-=20;
166
-			$this->posxqty-=20;
167
-			//$this->posxdiscount-=20;
168
-			//$this->postotalht-=20;
169
-		}
170
-
171
-		$this->tva=array();
172
-		$this->atleastoneratenotnull=0;
173
-		$this->atleastonediscount=0;
174
-	}
107
+    public $marge_basse;
108
+
109
+    /**
110
+     * Issuer
111
+     * @var Company object that emits
112
+     */
113
+    public $emetteur;
114
+
115
+    /**
116
+     *	Constructor
117
+     *
118
+     *  @param		DoliDB		$db      Database handler
119
+     */
120
+    function __construct($db)
121
+    {
122
+        global $conf,$langs,$mysoc;
123
+
124
+        // Translations
125
+        $langs->loadLangs(array("main", "bills", "sendings", "companies"));
126
+
127
+        $this->db = $db;
128
+        $this->name = "typhon";
129
+        $this->description = $langs->trans("DocumentModelTyphon");
130
+
131
+        // Dimension page pour format A4
132
+        $this->type = 'pdf';
133
+        $formatarray=pdf_getFormat();
134
+        $this->page_largeur = $formatarray['width'];
135
+        $this->page_hauteur = $formatarray['height'];
136
+        $this->format = array($this->page_largeur,$this->page_hauteur);
137
+        $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
138
+        $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
139
+        $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
140
+        $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
141
+
142
+        $this->option_logo = 1;                    // Affiche logo FAC_PDF_LOGO
143
+        $this->option_tva = 1;                     // Gere option tva FACTURE_TVAOPTION
144
+        $this->option_codeproduitservice = 1;      // Affiche code produit-service
145
+
146
+        $this->franchise=!$mysoc->tva_assuj;
147
+
148
+        // Get source company
149
+        $this->emetteur=$mysoc;
150
+        if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
151
+
152
+        // Define position of columns
153
+        $this->posxdesc=$this->marge_gauche+1;
154
+        $this->posxcomm=112;
155
+        //$this->posxtva=112;
156
+        //$this->posxup=126;
157
+        $this->posxqty=165;
158
+        $this->posxremainingqty=185;
159
+        //$this->posxdiscount=162;
160
+        //$this->postotalht=174;
161
+        if ($this->page_largeur < 210) // To work with US executive format
162
+        {
163
+            $this->posxcomm-=20;
164
+            //$this->posxtva-=20;
165
+            //$this->posxup-=20;
166
+            $this->posxqty-=20;
167
+            //$this->posxdiscount-=20;
168
+            //$this->postotalht-=20;
169
+        }
170
+
171
+        $this->tva=array();
172
+        $this->atleastoneratenotnull=0;
173
+        $this->atleastonediscount=0;
174
+    }
175 175
 
176 176
 
177 177
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -186,66 +186,66 @@  discard block
 block discarded – undo
186 186
      *  @param		int			$hideref			Do not show ref
187 187
      *  @return     int             			1=OK, 0=KO
188 188
      */
189
-	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
190
-	{
189
+    function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
190
+    {
191 191
         // phpcs:enable
192
-		global $user,$langs,$conf,$mysoc,$hookmanager;
193
-
194
-		if (! is_object($outputlangs)) $outputlangs=$langs;
195
-		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
196
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
197
-
198
-		// Load translation files required by the page
199
-		$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries"));
200
-
201
-		if ($conf->expedition->dir_output)
202
-		{
203
-			$object->fetch_thirdparty();
204
-
205
-			// Definition of $dir and $file
206
-			if ($object->specimen)
207
-			{
208
-				$dir = $conf->expedition->dir_output."/receipt";
209
-				$file = $dir . "/SPECIMEN.pdf";
210
-			}
211
-			else
212
-			{
213
-				$objectref = dol_sanitizeFileName($object->ref);
214
-				$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
215
-				$file = $dir . "/" . $objectref . ".pdf";
216
-			}
217
-
218
-			if (! file_exists($dir))
219
-			{
220
-				if (dol_mkdir($dir) < 0)
221
-				{
222
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
223
-					return 0;
224
-				}
225
-			}
192
+        global $user,$langs,$conf,$mysoc,$hookmanager;
193
+
194
+        if (! is_object($outputlangs)) $outputlangs=$langs;
195
+        // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
196
+        if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
197
+
198
+        // Load translation files required by the page
199
+        $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries"));
200
+
201
+        if ($conf->expedition->dir_output)
202
+        {
203
+            $object->fetch_thirdparty();
204
+
205
+            // Definition of $dir and $file
206
+            if ($object->specimen)
207
+            {
208
+                $dir = $conf->expedition->dir_output."/receipt";
209
+                $file = $dir . "/SPECIMEN.pdf";
210
+            }
211
+            else
212
+            {
213
+                $objectref = dol_sanitizeFileName($object->ref);
214
+                $dir = $conf->expedition->dir_output."/receipt/" . $objectref;
215
+                $file = $dir . "/" . $objectref . ".pdf";
216
+            }
217
+
218
+            if (! file_exists($dir))
219
+            {
220
+                if (dol_mkdir($dir) < 0)
221
+                {
222
+                    $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
223
+                    return 0;
224
+                }
225
+            }
226 226
 
227
-			if (file_exists($dir))
228
-			{
229
-				// Add pdfgeneration hook
230
-				if (! is_object($hookmanager))
231
-				{
232
-					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
233
-					$hookmanager=new HookManager($this->db);
234
-				}
235
-				$hookmanager->initHooks(array('pdfgeneration'));
236
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
237
-				global $action;
238
-				$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
227
+            if (file_exists($dir))
228
+            {
229
+                // Add pdfgeneration hook
230
+                if (! is_object($hookmanager))
231
+                {
232
+                    include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
233
+                    $hookmanager=new HookManager($this->db);
234
+                }
235
+                $hookmanager->initHooks(array('pdfgeneration'));
236
+                $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
237
+                global $action;
238
+                $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
239 239
 
240
-				$nblines = count($object->lines);
240
+                $nblines = count($object->lines);
241 241
 
242
-				// Create pdf instance
243
-				$pdf=pdf_getInstance($this->format);
242
+                // Create pdf instance
243
+                $pdf=pdf_getInstance($this->format);
244 244
                 $default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
245 245
                 $heightforinfotot = 30;	// Height reserved to output the info and total part
246
-		        $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
247
-	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
248
-	            if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
246
+                $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
247
+                $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
248
+                if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
249 249
                 $pdf->SetAutoPageBreak(1,0);
250 250
 
251 251
                 if (class_exists('TCPDF'))
@@ -261,33 +261,33 @@  discard block
 block discarded – undo
261 261
                     $tplidx = $pdf->importPage(1);
262 262
                 }
263 263
 
264
-				// We get the shipment that is the origin of delivery receipt
265
-				$expedition=new Expedition($this->db);
266
-				$result = $expedition->fetch($object->origin_id);
267
-				// Now we get the order that is origin of shipment
268
-				$commande = new Commande($this->db);
269
-				if ($expedition->origin == 'commande')
270
-				{
271
-					$commande->fetch($expedition->origin_id);
272
-				}
273
-				$object->commande=$commande;	// We set order of shipment onto delivery.
274
-				$object->commande->loadExpeditions();
264
+                // We get the shipment that is the origin of delivery receipt
265
+                $expedition=new Expedition($this->db);
266
+                $result = $expedition->fetch($object->origin_id);
267
+                // Now we get the order that is origin of shipment
268
+                $commande = new Commande($this->db);
269
+                if ($expedition->origin == 'commande')
270
+                {
271
+                    $commande->fetch($expedition->origin_id);
272
+                }
273
+                $object->commande=$commande;	// We set order of shipment onto delivery.
274
+                $object->commande->loadExpeditions();
275 275
 
276 276
 
277
-				$pdf->Open();
278
-				$pagenb=0;
279
-				$pdf->SetDrawColor(128,128,128);
277
+                $pdf->Open();
278
+                $pagenb=0;
279
+                $pdf->SetDrawColor(128,128,128);
280 280
 
281
-				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
282
-				$pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
283
-				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
284
-				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
285
-				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
286
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
281
+                $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
282
+                $pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
283
+                $pdf->SetCreator("Dolibarr ".DOL_VERSION);
284
+                $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
285
+                $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
286
+                if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
287 287
 
288
-				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
288
+                $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
289 289
 
290
-				/*
290
+                /*
291 291
 				// Positionne $this->atleastonediscount si on a au moins une remise
292 292
 				for ($i = 0 ; $i < $nblines ; $i++)
293 293
 				{
@@ -307,82 +307,82 @@  discard block
 block discarded – undo
307 307
 				}
308 308
 				*/
309 309
 
310
-				// New page
311
-				$pdf->AddPage();
312
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
313
-				$pagenb++;
314
-				$this->_pagehead($pdf, $object, 1, $outputlangs);
315
-				$pdf->SetFont('','', $default_font_size - 1);
316
-				$pdf->MultiCell(0, 3, '');		// Set interline to 3
317
-				$pdf->SetTextColor(0,0,0);
318
-
319
-				$tab_top = 90;
320
-				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
321
-				$tab_height = 130;
322
-				$tab_height_newpage = 150;
323
-
324
-				// Incoterm
325
-				$height_incoterms = 0;
326
-				if ($conf->incoterm->enabled)
327
-				{
328
-					$desc_incoterms = $object->getIncotermsForPDF();
329
-					if ($desc_incoterms)
330
-					{
331
-						$tab_top = 88;
310
+                // New page
311
+                $pdf->AddPage();
312
+                if (! empty($tplidx)) $pdf->useTemplate($tplidx);
313
+                $pagenb++;
314
+                $this->_pagehead($pdf, $object, 1, $outputlangs);
315
+                $pdf->SetFont('','', $default_font_size - 1);
316
+                $pdf->MultiCell(0, 3, '');		// Set interline to 3
317
+                $pdf->SetTextColor(0,0,0);
318
+
319
+                $tab_top = 90;
320
+                $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
321
+                $tab_height = 130;
322
+                $tab_height_newpage = 150;
323
+
324
+                // Incoterm
325
+                $height_incoterms = 0;
326
+                if ($conf->incoterm->enabled)
327
+                {
328
+                    $desc_incoterms = $object->getIncotermsForPDF();
329
+                    if ($desc_incoterms)
330
+                    {
331
+                        $tab_top = 88;
332 332
 
333
-						$pdf->SetFont('','', $default_font_size - 1);
334
-						$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
335
-						$nexY = $pdf->GetY();
336
-						$height_incoterms=$nexY-$tab_top;
333
+                        $pdf->SetFont('','', $default_font_size - 1);
334
+                        $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
335
+                        $nexY = $pdf->GetY();
336
+                        $height_incoterms=$nexY-$tab_top;
337 337
 
338
-						// Rect prend une longueur en 3eme param
339
-						$pdf->SetDrawColor(192,192,192);
340
-						$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
338
+                        // Rect prend une longueur en 3eme param
339
+                        $pdf->SetDrawColor(192,192,192);
340
+                        $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
341 341
 
342
-						$tab_top = $nexY+6;
343
-						$height_incoterms += 4;
344
-					}
345
-				}
342
+                        $tab_top = $nexY+6;
343
+                        $height_incoterms += 4;
344
+                    }
345
+                }
346 346
 
347
-				// Affiche notes
348
-				if (! empty($object->note_public))
349
-				{
350
-					$tab_top = 88 + $height_incoterms;
347
+                // Affiche notes
348
+                if (! empty($object->note_public))
349
+                {
350
+                    $tab_top = 88 + $height_incoterms;
351 351
 
352
-					$pdf->SetFont('','', $default_font_size - 1);
353
-					$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
354
-					$nexY = $pdf->GetY();
355
-					$height_note=$nexY-$tab_top;
352
+                    $pdf->SetFont('','', $default_font_size - 1);
353
+                    $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
354
+                    $nexY = $pdf->GetY();
355
+                    $height_note=$nexY-$tab_top;
356 356
 
357
-					// Rect prend une longueur en 3eme param
358
-					$pdf->SetDrawColor(192,192,192);
359
-					$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
357
+                    // Rect prend une longueur en 3eme param
358
+                    $pdf->SetDrawColor(192,192,192);
359
+                    $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
360 360
 
361
-					$tab_height = $tab_height - $height_note;
362
-					$tab_top = $nexY+6;
363
-				}
364
-				else
365
-				{
366
-					$height_note=0;
367
-				}
361
+                    $tab_height = $tab_height - $height_note;
362
+                    $tab_top = $nexY+6;
363
+                }
364
+                else
365
+                {
366
+                    $height_note=0;
367
+                }
368 368
 
369
-				$iniY = $tab_top + 11;
370
-				$curY = $tab_top + 11;
371
-				$nexY = $tab_top + 11;
369
+                $iniY = $tab_top + 11;
370
+                $curY = $tab_top + 11;
371
+                $nexY = $tab_top + 11;
372 372
 
373
-				// Loop on each lines
374
-				for ($i = 0 ; $i < $nblines ; $i++)
375
-				{
376
-					$curY = $nexY;
377
-					$pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
378
-					$pdf->SetTextColor(0,0,0);
373
+                // Loop on each lines
374
+                for ($i = 0 ; $i < $nblines ; $i++)
375
+                {
376
+                    $curY = $nexY;
377
+                    $pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
378
+                    $pdf->SetTextColor(0,0,0);
379 379
 
380
-					$pdf->setTopMargin($tab_top_newpage);
381
-					$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
382
-					$pageposbefore=$pdf->getPage();
380
+                    $pdf->setTopMargin($tab_top_newpage);
381
+                    $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
382
+                    $pageposbefore=$pdf->getPage();
383 383
 
384
-					// Description of product line
385
-					$curX = $this->posxdesc-1;
384
+                    // Description of product line
385
+                    $curX = $this->posxdesc-1;
386 386
 
387 387
                     $showpricebeforepagebreak=1;
388 388
 
@@ -391,47 +391,47 @@  discard block
 block discarded – undo
391 391
                     $pageposafter=$pdf->getPage();
392 392
                     if ($pageposafter > $pageposbefore)	// There is a pagebreak
393 393
                     {
394
-                    	$pdf->rollbackTransaction(true);
395
-                    	$pageposafter=$pageposbefore;
396
-                    	//print $pageposafter.'-'.$pageposbefore;exit;
397
-                    	$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
398
-                    	pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc);
399
-                    	$posyafter=$pdf->GetY();
400
-                    	if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
401
-                    	{
402
-                    		if ($i == ($nblines-1))	// No more lines, and no space left to show total, so we create a new page
403
-                    		{
404
-                    			$pdf->AddPage('','',true);
405
-                    			if (! empty($tplidx)) $pdf->useTemplate($tplidx);
406
-                    			if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
407
-                    			$pdf->setPage($pageposafter+1);
408
-                    		}
409
-                    	}
410
-                    	else
411
-                    	{
412
-                    		// We found a page break
413
-                    		$showpricebeforepagebreak=0;
414
-                    	}
394
+                        $pdf->rollbackTransaction(true);
395
+                        $pageposafter=$pageposbefore;
396
+                        //print $pageposafter.'-'.$pageposbefore;exit;
397
+                        $pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
398
+                        pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc);
399
+                        $posyafter=$pdf->GetY();
400
+                        if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
401
+                        {
402
+                            if ($i == ($nblines-1))	// No more lines, and no space left to show total, so we create a new page
403
+                            {
404
+                                $pdf->AddPage('','',true);
405
+                                if (! empty($tplidx)) $pdf->useTemplate($tplidx);
406
+                                if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
407
+                                $pdf->setPage($pageposafter+1);
408
+                            }
409
+                        }
410
+                        else
411
+                        {
412
+                            // We found a page break
413
+                            $showpricebeforepagebreak=0;
414
+                        }
415 415
                     }
416 416
                     else	// No pagebreak
417 417
                     {
418
-                    	$pdf->commitTransaction();
418
+                        $pdf->commitTransaction();
419 419
                     }
420 420
 
421
-					$nexY = $pdf->GetY();
421
+                    $nexY = $pdf->GetY();
422 422
                     $pageposafter=$pdf->getPage();
423
-					$pdf->setPage($pageposbefore);
424
-					$pdf->setTopMargin($this->marge_haute);
425
-					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
423
+                    $pdf->setPage($pageposbefore);
424
+                    $pdf->setTopMargin($this->marge_haute);
425
+                    $pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
426 426
 
427
-					// We suppose that a too long description is moved completely on next page
428
-					if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
429
-						$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
430
-					}
427
+                    // We suppose that a too long description is moved completely on next page
428
+                    if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
429
+                        $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
430
+                    }
431 431
 
432
-					$pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
432
+                    $pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
433 433
 
434
-					/*
434
+                    /*
435 435
 					 // TVA
436 436
 					 $pdf->SetXY($this->posxcomm, $curY);
437 437
 					 $pdf->MultiCell(10, 4, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R');
@@ -440,16 +440,16 @@  discard block
 block discarded – undo
440 440
 					 $pdf->SetXY($this->posxup, $curY);
441 441
 					 $pdf->MultiCell(20, 4, price($object->lines[$i]->subprice), 0, 'R', 0);
442 442
 					 */
443
-					// Quantity
444
-					//$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
445
-					$pdf->SetXY($this->posxqty, $curY);
446
-					$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R');
447
-
448
-					// Remaining to ship
449
-					$pdf->SetXY($this->posxremainingqty, $curY);
450
-					$qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
451
-					$pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');
452
-					/*
443
+                    // Quantity
444
+                    //$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
445
+                    $pdf->SetXY($this->posxqty, $curY);
446
+                    $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R');
447
+
448
+                    // Remaining to ship
449
+                    $pdf->SetXY($this->posxremainingqty, $curY);
450
+                    $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
451
+                    $pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');
452
+                    /*
453 453
 					 // Remise sur ligne
454 454
 					 $pdf->SetXY($this->posxdiscount, $curY);
455 455
 					 if ($object->lines[$i]->remise_percent)
@@ -469,79 +469,79 @@  discard block
 block discarded – undo
469 469
 					 $this->tva[ (string) $object->lines[$i]->tva_tx ] += $tvaligne;
470 470
 					 */
471 471
 
472
-					// Add line
473
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
474
-					{
475
-						$pdf->setPage($pageposafter);
476
-						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
477
-						//$pdf->SetDrawColor(190,190,200);
478
-						$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
479
-						$pdf->SetLineStyle(array('dash'=>0));
480
-					}
472
+                    // Add line
473
+                    if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
474
+                    {
475
+                        $pdf->setPage($pageposafter);
476
+                        $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
477
+                        //$pdf->SetDrawColor(190,190,200);
478
+                        $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
479
+                        $pdf->SetLineStyle(array('dash'=>0));
480
+                    }
481 481
 
482
-					$nexY+=2;    // Passe espace entre les lignes
482
+                    $nexY+=2;    // Passe espace entre les lignes
483 483
 
484
-					// Detect if some page were added automatically and output _tableau for past pages
485
-					while ($pagenb < $pageposafter)
486
-					{
487
-						$pdf->setPage($pagenb);
488
-						if ($pagenb == 1)
489
-						{
490
-							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
491
-						}
492
-						else
493
-						{
494
-							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
495
-						}
496
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
497
-						$pagenb++;
498
-						$pdf->setPage($pagenb);
499
-						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
500
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
501
-					}
502
-					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
503
-					{
504
-						if ($pagenb == 1)
505
-						{
506
-							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
507
-						}
508
-						else
509
-						{
510
-							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
511
-						}
512
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
513
-						// New page
514
-						$pdf->AddPage();
515
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
516
-						$pagenb++;
517
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
518
-					}
519
-				}
484
+                    // Detect if some page were added automatically and output _tableau for past pages
485
+                    while ($pagenb < $pageposafter)
486
+                    {
487
+                        $pdf->setPage($pagenb);
488
+                        if ($pagenb == 1)
489
+                        {
490
+                            $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
491
+                        }
492
+                        else
493
+                        {
494
+                            $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
495
+                        }
496
+                        $this->_pagefoot($pdf,$object,$outputlangs,1);
497
+                        $pagenb++;
498
+                        $pdf->setPage($pagenb);
499
+                        $pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
500
+                        if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
501
+                    }
502
+                    if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
503
+                    {
504
+                        if ($pagenb == 1)
505
+                        {
506
+                            $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
507
+                        }
508
+                        else
509
+                        {
510
+                            $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
511
+                        }
512
+                        $this->_pagefoot($pdf,$object,$outputlangs,1);
513
+                        // New page
514
+                        $pdf->AddPage();
515
+                        if (! empty($tplidx)) $pdf->useTemplate($tplidx);
516
+                        $pagenb++;
517
+                        if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
518
+                    }
519
+                }
520 520
 
521
-				// Show square
522
-				if ($pagenb == 1)
523
-				{
524
-					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
525
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
526
-				}
527
-				else
528
-				{
529
-					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
530
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
531
-				}
521
+                // Show square
522
+                if ($pagenb == 1)
523
+                {
524
+                    $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
525
+                    $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
526
+                }
527
+                else
528
+                {
529
+                    $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
530
+                    $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
531
+                }
532 532
 
533
-				// Affiche zone infos
534
-				$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
533
+                // Affiche zone infos
534
+                $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
535 535
 
536
-				// Pied de page
537
-				$this->_pagefoot($pdf,$object,$outputlangs);
536
+                // Pied de page
537
+                $this->_pagefoot($pdf,$object,$outputlangs);
538 538
 
539
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
539
+                if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
540 540
 
541
-				// Check product remaining to be delivered
542
-				// TODO doit etre modifie
543
-				//$waitingDelivery = $object->getRemainingDelivered();
544
-				/*
541
+                // Check product remaining to be delivered
542
+                // TODO doit etre modifie
543
+                //$waitingDelivery = $object->getRemainingDelivered();
544
+                /*
545 545
 				$waitingDelivery='';
546 546
 
547 547
 				if (is_array($waitingDelivery) & !empty($waitingDelivery))
@@ -599,324 +599,324 @@  discard block
 block discarded – undo
599 599
 					if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
600 600
 				}*/
601 601
 
602
-				$pdf->Close();
602
+                $pdf->Close();
603 603
 
604
-				$pdf->Output($file,'F');
604
+                $pdf->Output($file,'F');
605 605
 
606
-				// Add pdfgeneration hook
607
-				if (! is_object($hookmanager))
608
-				{
609
-					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
610
-					$hookmanager=new HookManager($this->db);
611
-				}
612
-				$hookmanager->initHooks(array('pdfgeneration'));
613
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
614
-				global $action;
615
-				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
606
+                // Add pdfgeneration hook
607
+                if (! is_object($hookmanager))
608
+                {
609
+                    include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
610
+                    $hookmanager=new HookManager($this->db);
611
+                }
612
+                $hookmanager->initHooks(array('pdfgeneration'));
613
+                $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
614
+                global $action;
615
+                $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
616 616
 
617
-				if (! empty($conf->global->MAIN_UMASK))
618
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
617
+                if (! empty($conf->global->MAIN_UMASK))
618
+                    @chmod($file, octdec($conf->global->MAIN_UMASK));
619 619
 
620
-				$this->result = array('fullpath'=>$file);
620
+                $this->result = array('fullpath'=>$file);
621 621
 
622
-				return 1;	// pas d'erreur
623
-			}
624
-			else
625
-			{
626
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
627
-				return 0;
628
-			}
629
-		}
622
+                return 1;	// pas d'erreur
623
+            }
624
+            else
625
+            {
626
+                $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
627
+                return 0;
628
+            }
629
+        }
630 630
 
631
-		$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
632
-		return 0;
633
-	}
631
+        $this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
632
+        return 0;
633
+    }
634 634
 
635 635
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
636
-	/**
637
-	 *   Show miscellaneous information (payment mode, payment term, ...)
638
-	 *
639
-	 *   @param		PDF			$pdf     		Object PDF
640
-	 *   @param		Object		$object			Object to show
641
-	 *   @param		int			$posy			Y
642
-	 *   @param		Translate	$outputlangs	Langs object
643
-	 *   @return	void
644
-	 */
645
-	function _tableau_info(&$pdf, $object, $posy, $outputlangs)
646
-	{
636
+    /**
637
+     *   Show miscellaneous information (payment mode, payment term, ...)
638
+     *
639
+     *   @param		PDF			$pdf     		Object PDF
640
+     *   @param		Object		$object			Object to show
641
+     *   @param		int			$posy			Y
642
+     *   @param		Translate	$outputlangs	Langs object
643
+     *   @return	void
644
+     */
645
+    function _tableau_info(&$pdf, $object, $posy, $outputlangs)
646
+    {
647 647
         // phpcs:enable
648
-		global $conf,$mysoc;
649
-		$default_font_size = pdf_getPDFFontSize($outputlangs);
650
-
651
-		$pdf->SetFont('','', $default_font_size);
652
-		$pdf->SetXY($this->marge_gauche, $posy);
653
-
654
-		$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
655
-		$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
656
-		$pdf->SetXY($this->marge_gauche + 2, $posy + 2);
657
-		$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
658
-
659
-		$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
660
-		$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
661
-		$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
662
-	}
663
-
664
-	/**
665
-	 *   Show table for lines
666
-	 *
667
-	 *   @param		PDF			$pdf     		Object PDF
668
-	 *   @param		string		$tab_top		Top position of table
669
-	 *   @param		string		$tab_height		Height of table (rectangle)
670
-	 *   @param		int			$nexY			Y (not used)
671
-	 *   @param		Translate	$outputlangs	Langs object
672
-	 *   @param		int			$hidetop		1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
673
-	 *   @param		int			$hidebottom		Hide bottom bar of array
674
-	 *   @return	void
675
-	 */
676
-	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
677
-	{
678
-		global $conf,$mysoc;
679
-
680
-		// Force to disable hidetop and hidebottom
681
-		$hidebottom=0;
682
-		if ($hidetop) $hidetop=-1;
683
-
684
-		$default_font_size = pdf_getPDFFontSize($outputlangs);
685
-
686
-		// Amount in (at tab_top - 1)
687
-		$pdf->SetTextColor(0,0,0);
688
-		$pdf->SetFont('','', $default_font_size - 2);
689
-
690
-		// Output Rec
691
-		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);	// Rect prend une longueur en 3eme param et 4eme param
692
-
693
-		if (empty($hidetop))
694
-		{
695
-			$pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10);
696
-		}
697
-
698
-		$pdf->SetDrawColor(128,128,128);
699
-		$pdf->SetFont('','', $default_font_size - 1);
700
-
701
-		if (empty($hidetop))
702
-		{
703
-			$pdf->SetXY($this->posxdesc-1, $tab_top+1);
704
-			$pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
705
-		}
706
-
707
-		// Modif SEB pour avoir une col en plus pour les commentaires clients
708
-		$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
709
-		if (empty($hidetop)) {
710
-			$pdf->SetXY($this->posxcomm, $tab_top+1);
711
-			$pdf->MultiCell($this->posxqty - $this->posxcomm,2, $outputlangs->transnoentities("Comments"),'','L');
712
-		}
713
-
714
-		// Qty
715
-		$pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height);
716
-		if (empty($hidetop)) {
717
-			$pdf->SetXY($this->posxqty, $tab_top+1);
718
-			$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"),'','R');
719
-		}
720
-
721
-		// Remain to ship
722
-		$pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height);
723
-		if (empty($hidetop)) {
724
-			$pdf->SetXY($this->posxremainingqty, $tab_top+1);
725
-			$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"),'','R');
726
-		}
727
-	}
728
-
729
-	/**
730
-	 *  Show top header of page.
731
-	 *
732
-	 *  @param	PDF			$pdf     		Object PDF
733
-	 *  @param  Object		$object     	Object to show
734
-	 *  @param  int	    	$showaddress    0=no, 1=yes
735
-	 *  @param  Translate	$outputlangs	Object lang for output
736
-	 *  @return	void
737
-	 */
738
-	function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
739
-	{
740
-		global $conf,$langs,$hookmanager;
741
-
742
-		$default_font_size = pdf_getPDFFontSize($outputlangs);
743
-
744
-		pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
745
-
746
-		// Show Draft Watermark
747
-		if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
748
-		{
749
-			pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
750
-		}
751
-
752
-		$pdf->SetTextColor(0,0,60);
753
-		$pdf->SetFont('','B', $default_font_size + 3);
754
-
755
-		$posy=$this->marge_haute;
756
-		$posx=$this->page_largeur-$this->marge_droite-100;
757
-
758
-		$pdf->SetXY($this->marge_gauche,$posy);
759
-
760
-		// Logo
761
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
762
-		if ($this->emetteur->logo)
763
-		{
764
-			if (is_readable($logo))
765
-			{
766
-			    $height=pdf_getHeightForLogo($logo);
767
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
768
-			}
769
-			else
770
-			{
771
-				$pdf->SetTextColor(200,0,0);
772
-				$pdf->SetFont('','B', $default_font_size - 2);
773
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
774
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
775
-			}
776
-		}
777
-		else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
778
-
779
-		$pdf->SetFont('','B', $default_font_size + 2);
780
-		$pdf->SetXY($posx,$posy);
781
-		$pdf->SetTextColor(0,0,60);
782
-		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
783
-
784
-		$pdf->SetFont('','',$default_font_size + 2);
785
-
786
-		$posy+=5;
787
-		$pdf->SetXY($posx,$posy);
788
-		$pdf->SetTextColor(0,0,60);
789
-		if ($object->date_valid)
790
-		{
791
-			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,"%d %b %Y",false,$outputlangs,true), '', 'R');
792
-		}
793
-		else
794
-		{
795
-			$pdf->SetTextColor(255,0,0);
796
-			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
797
-			$pdf->SetTextColor(0,0,60);
798
-		}
799
-
800
-		if ($object->thirdparty->code_client)
801
-		{
802
-			$posy+=5;
803
-			$pdf->SetXY($posx,$posy);
804
-			$pdf->SetTextColor(0,0,60);
805
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
806
-		}
807
-
808
-		$pdf->SetTextColor(0,0,60);
809
-
810
-		$posy+=2;
811
-
812
-		// Show list of linked objects
813
-		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
814
-
815
-		if ($showaddress)
816
-		{
817
-			// Sender properties
818
-			$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur, $object->thirdparty, '', 0, 'source', $object);
819
-
820
-			// Show sender
821
-			$posy=42;
822
-			$posx=$this->marge_gauche;
823
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
824
-			$hautcadre=40;
825
-
826
-			// Show sender frame
827
-			$pdf->SetTextColor(0,0,0);
828
-			$pdf->SetFont('','', $default_font_size - 2);
829
-			$pdf->SetXY($posx,$posy-5);
830
-			$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
831
-			$pdf->SetXY($posx,$posy);
832
-			$pdf->SetFillColor(230,230,230);
833
-			$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
834
-			$pdf->SetTextColor(0,0,60);
835
-
836
-			// Show sender name
837
-			$pdf->SetXY($posx+2,$posy+3);
838
-			$pdf->SetFont('','B',$default_font_size);
839
-			$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
840
-			$posy=$pdf->getY();
841
-
842
-			// Show sender information
843
-			$pdf->SetXY($posx+2,$posy);
844
-			$pdf->SetFont('','', $default_font_size - 1);
845
-			$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
846
-
847
-			// Client destinataire
848
-			$posy=42;
849
-			$posx=102;
850
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
851
-			$pdf->SetTextColor(0,0,0);
852
-			$pdf->SetFont('','', $default_font_size - 2);
853
-			$pdf->SetXY($posx,$posy-5);
854
-			$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
855
-
856
-			// If SHIPPING contact defined on order, we use it
857
-			$usecontact=false;
858
-			$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
859
-			if (count($arrayidcontact) > 0)
860
-			{
861
-				$usecontact=true;
862
-				$result=$object->fetch_contact($arrayidcontact[0]);
863
-			}
864
-
865
-			//Recipient name
866
-			// On peut utiliser le nom de la societe du contact
867
-			if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
868
-				$thirdparty = $object->contact;
869
-			} else {
870
-				$thirdparty = $object->thirdparty;
871
-			}
872
-
873
-			$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
874
-
875
-			$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
876
-
877
-			// Show recipient
878
-			$widthrecbox=100;
879
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
880
-			$posy=42;
881
-			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
882
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
883
-
884
-			// Show recipient frame
885
-			$pdf->SetTextColor(0,0,0);
886
-			$pdf->SetFont('','', $default_font_size - 2);
887
-			$pdf->SetXY($posx+2,$posy-5);
888
-			//$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
889
-			$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
890
-
891
-			// Show recipient name
892
-			$pdf->SetXY($posx+2,$posy+3);
893
-			$pdf->SetFont('','B', $default_font_size);
894
-			$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
895
-
896
-			$posy = $pdf->getY();
897
-
898
-			// Show recipient information
899
-			$pdf->SetFont('','', $default_font_size - 1);
900
-			$pdf->SetXY($posx+2,$posy);
901
-			$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
902
-		}
903
-
904
-		$pdf->SetTextColor(0,0,60);
905
-	}
906
-
907
-	/**
908
-	 *   	Show footer of page. Need this->emetteur object
648
+        global $conf,$mysoc;
649
+        $default_font_size = pdf_getPDFFontSize($outputlangs);
650
+
651
+        $pdf->SetFont('','', $default_font_size);
652
+        $pdf->SetXY($this->marge_gauche, $posy);
653
+
654
+        $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
655
+        $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
656
+        $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
657
+        $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
658
+
659
+        $pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
660
+        $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
661
+        $pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
662
+    }
663
+
664
+    /**
665
+     *   Show table for lines
666
+     *
667
+     *   @param		PDF			$pdf     		Object PDF
668
+     *   @param		string		$tab_top		Top position of table
669
+     *   @param		string		$tab_height		Height of table (rectangle)
670
+     *   @param		int			$nexY			Y (not used)
671
+     *   @param		Translate	$outputlangs	Langs object
672
+     *   @param		int			$hidetop		1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
673
+     *   @param		int			$hidebottom		Hide bottom bar of array
674
+     *   @return	void
675
+     */
676
+    function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
677
+    {
678
+        global $conf,$mysoc;
679
+
680
+        // Force to disable hidetop and hidebottom
681
+        $hidebottom=0;
682
+        if ($hidetop) $hidetop=-1;
683
+
684
+        $default_font_size = pdf_getPDFFontSize($outputlangs);
685
+
686
+        // Amount in (at tab_top - 1)
687
+        $pdf->SetTextColor(0,0,0);
688
+        $pdf->SetFont('','', $default_font_size - 2);
689
+
690
+        // Output Rec
691
+        $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);	// Rect prend une longueur en 3eme param et 4eme param
692
+
693
+        if (empty($hidetop))
694
+        {
695
+            $pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10);
696
+        }
697
+
698
+        $pdf->SetDrawColor(128,128,128);
699
+        $pdf->SetFont('','', $default_font_size - 1);
700
+
701
+        if (empty($hidetop))
702
+        {
703
+            $pdf->SetXY($this->posxdesc-1, $tab_top+1);
704
+            $pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
705
+        }
706
+
707
+        // Modif SEB pour avoir une col en plus pour les commentaires clients
708
+        $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
709
+        if (empty($hidetop)) {
710
+            $pdf->SetXY($this->posxcomm, $tab_top+1);
711
+            $pdf->MultiCell($this->posxqty - $this->posxcomm,2, $outputlangs->transnoentities("Comments"),'','L');
712
+        }
713
+
714
+        // Qty
715
+        $pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height);
716
+        if (empty($hidetop)) {
717
+            $pdf->SetXY($this->posxqty, $tab_top+1);
718
+            $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"),'','R');
719
+        }
720
+
721
+        // Remain to ship
722
+        $pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height);
723
+        if (empty($hidetop)) {
724
+            $pdf->SetXY($this->posxremainingqty, $tab_top+1);
725
+            $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"),'','R');
726
+        }
727
+    }
728
+
729
+    /**
730
+     *  Show top header of page.
731
+     *
732
+     *  @param	PDF			$pdf     		Object PDF
733
+     *  @param  Object		$object     	Object to show
734
+     *  @param  int	    	$showaddress    0=no, 1=yes
735
+     *  @param  Translate	$outputlangs	Object lang for output
736
+     *  @return	void
737
+     */
738
+    function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
739
+    {
740
+        global $conf,$langs,$hookmanager;
741
+
742
+        $default_font_size = pdf_getPDFFontSize($outputlangs);
743
+
744
+        pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
745
+
746
+        // Show Draft Watermark
747
+        if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
748
+        {
749
+            pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
750
+        }
751
+
752
+        $pdf->SetTextColor(0,0,60);
753
+        $pdf->SetFont('','B', $default_font_size + 3);
754
+
755
+        $posy=$this->marge_haute;
756
+        $posx=$this->page_largeur-$this->marge_droite-100;
757
+
758
+        $pdf->SetXY($this->marge_gauche,$posy);
759
+
760
+        // Logo
761
+        $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
762
+        if ($this->emetteur->logo)
763
+        {
764
+            if (is_readable($logo))
765
+            {
766
+                $height=pdf_getHeightForLogo($logo);
767
+                $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
768
+            }
769
+            else
770
+            {
771
+                $pdf->SetTextColor(200,0,0);
772
+                $pdf->SetFont('','B', $default_font_size - 2);
773
+                $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
774
+                $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
775
+            }
776
+        }
777
+        else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
778
+
779
+        $pdf->SetFont('','B', $default_font_size + 2);
780
+        $pdf->SetXY($posx,$posy);
781
+        $pdf->SetTextColor(0,0,60);
782
+        $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
783
+
784
+        $pdf->SetFont('','',$default_font_size + 2);
785
+
786
+        $posy+=5;
787
+        $pdf->SetXY($posx,$posy);
788
+        $pdf->SetTextColor(0,0,60);
789
+        if ($object->date_valid)
790
+        {
791
+            $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,"%d %b %Y",false,$outputlangs,true), '', 'R');
792
+        }
793
+        else
794
+        {
795
+            $pdf->SetTextColor(255,0,0);
796
+            $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
797
+            $pdf->SetTextColor(0,0,60);
798
+        }
799
+
800
+        if ($object->thirdparty->code_client)
801
+        {
802
+            $posy+=5;
803
+            $pdf->SetXY($posx,$posy);
804
+            $pdf->SetTextColor(0,0,60);
805
+            $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
806
+        }
807
+
808
+        $pdf->SetTextColor(0,0,60);
809
+
810
+        $posy+=2;
811
+
812
+        // Show list of linked objects
813
+        $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
814
+
815
+        if ($showaddress)
816
+        {
817
+            // Sender properties
818
+            $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur, $object->thirdparty, '', 0, 'source', $object);
819
+
820
+            // Show sender
821
+            $posy=42;
822
+            $posx=$this->marge_gauche;
823
+            if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
824
+            $hautcadre=40;
825
+
826
+            // Show sender frame
827
+            $pdf->SetTextColor(0,0,0);
828
+            $pdf->SetFont('','', $default_font_size - 2);
829
+            $pdf->SetXY($posx,$posy-5);
830
+            $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
831
+            $pdf->SetXY($posx,$posy);
832
+            $pdf->SetFillColor(230,230,230);
833
+            $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
834
+            $pdf->SetTextColor(0,0,60);
835
+
836
+            // Show sender name
837
+            $pdf->SetXY($posx+2,$posy+3);
838
+            $pdf->SetFont('','B',$default_font_size);
839
+            $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
840
+            $posy=$pdf->getY();
841
+
842
+            // Show sender information
843
+            $pdf->SetXY($posx+2,$posy);
844
+            $pdf->SetFont('','', $default_font_size - 1);
845
+            $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
846
+
847
+            // Client destinataire
848
+            $posy=42;
849
+            $posx=102;
850
+            if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
851
+            $pdf->SetTextColor(0,0,0);
852
+            $pdf->SetFont('','', $default_font_size - 2);
853
+            $pdf->SetXY($posx,$posy-5);
854
+            $pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
855
+
856
+            // If SHIPPING contact defined on order, we use it
857
+            $usecontact=false;
858
+            $arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
859
+            if (count($arrayidcontact) > 0)
860
+            {
861
+                $usecontact=true;
862
+                $result=$object->fetch_contact($arrayidcontact[0]);
863
+            }
864
+
865
+            //Recipient name
866
+            // On peut utiliser le nom de la societe du contact
867
+            if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
868
+                $thirdparty = $object->contact;
869
+            } else {
870
+                $thirdparty = $object->thirdparty;
871
+            }
872
+
873
+            $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
874
+
875
+            $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
876
+
877
+            // Show recipient
878
+            $widthrecbox=100;
879
+            if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
880
+            $posy=42;
881
+            $posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
882
+            if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
883
+
884
+            // Show recipient frame
885
+            $pdf->SetTextColor(0,0,0);
886
+            $pdf->SetFont('','', $default_font_size - 2);
887
+            $pdf->SetXY($posx+2,$posy-5);
888
+            //$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
889
+            $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
890
+
891
+            // Show recipient name
892
+            $pdf->SetXY($posx+2,$posy+3);
893
+            $pdf->SetFont('','B', $default_font_size);
894
+            $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
895
+
896
+            $posy = $pdf->getY();
897
+
898
+            // Show recipient information
899
+            $pdf->SetFont('','', $default_font_size - 1);
900
+            $pdf->SetXY($posx+2,$posy);
901
+            $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
902
+        }
903
+
904
+        $pdf->SetTextColor(0,0,60);
905
+    }
906
+
907
+    /**
908
+     *   	Show footer of page. Need this->emetteur object
909 909
      *
910
-	 *   	@param	PDF			$pdf     			PDF
911
-	 * 		@param	Object		$object				Object to show
912
-	 *      @param	Translate	$outputlangs		Object lang for output
913
-	 *      @param	int			$hidefreetext		1=Hide free text
914
-	 *      @return	int								Return height of bottom margin including footer text
915
-	 */
916
-	function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
917
-	{
918
-		global $conf;
919
-		$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
920
-		return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
921
-	}
910
+     *   	@param	PDF			$pdf     			PDF
911
+     * 		@param	Object		$object				Object to show
912
+     *      @param	Translate	$outputlangs		Object lang for output
913
+     *      @param	int			$hidefreetext		1=Hide free text
914
+     *      @return	int								Return height of bottom margin including footer text
915
+     */
916
+    function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
917
+    {
918
+        global $conf;
919
+        $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
920
+        return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
921
+    }
922 922
 }
Please login to merge, or discard this patch.
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	function __construct($db)
121 121
 	{
122
-		global $conf,$langs,$mysoc;
122
+		global $conf, $langs, $mysoc;
123 123
 
124 124
 		// Translations
125 125
 		$langs->loadLangs(array("main", "bills", "sendings", "companies"));
@@ -130,47 +130,47 @@  discard block
 block discarded – undo
130 130
 
131 131
 		// Dimension page pour format A4
132 132
 		$this->type = 'pdf';
133
-		$formatarray=pdf_getFormat();
133
+		$formatarray = pdf_getFormat();
134 134
 		$this->page_largeur = $formatarray['width'];
135 135
 		$this->page_hauteur = $formatarray['height'];
136
-		$this->format = array($this->page_largeur,$this->page_hauteur);
137
-		$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
138
-		$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
139
-		$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
140
-		$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
136
+		$this->format = array($this->page_largeur, $this->page_hauteur);
137
+		$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
138
+		$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
139
+		$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
140
+		$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
141 141
 
142
-		$this->option_logo = 1;                    // Affiche logo FAC_PDF_LOGO
143
-		$this->option_tva = 1;                     // Gere option tva FACTURE_TVAOPTION
144
-		$this->option_codeproduitservice = 1;      // Affiche code produit-service
142
+		$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
143
+		$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
144
+		$this->option_codeproduitservice = 1; // Affiche code produit-service
145 145
 
146
-		$this->franchise=!$mysoc->tva_assuj;
146
+		$this->franchise = !$mysoc->tva_assuj;
147 147
 
148 148
 		// Get source company
149
-		$this->emetteur=$mysoc;
150
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
149
+		$this->emetteur = $mysoc;
150
+		if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
151 151
 
152 152
 		// Define position of columns
153
-		$this->posxdesc=$this->marge_gauche+1;
154
-		$this->posxcomm=112;
153
+		$this->posxdesc = $this->marge_gauche + 1;
154
+		$this->posxcomm = 112;
155 155
 		//$this->posxtva=112;
156 156
 		//$this->posxup=126;
157
-		$this->posxqty=165;
158
-		$this->posxremainingqty=185;
157
+		$this->posxqty = 165;
158
+		$this->posxremainingqty = 185;
159 159
 		//$this->posxdiscount=162;
160 160
 		//$this->postotalht=174;
161 161
 		if ($this->page_largeur < 210) // To work with US executive format
162 162
 		{
163
-			$this->posxcomm-=20;
163
+			$this->posxcomm -= 20;
164 164
 			//$this->posxtva-=20;
165 165
 			//$this->posxup-=20;
166
-			$this->posxqty-=20;
166
+			$this->posxqty -= 20;
167 167
 			//$this->posxdiscount-=20;
168 168
 			//$this->postotalht-=20;
169 169
 		}
170 170
 
171
-		$this->tva=array();
172
-		$this->atleastoneratenotnull=0;
173
-		$this->atleastonediscount=0;
171
+		$this->tva = array();
172
+		$this->atleastoneratenotnull = 0;
173
+		$this->atleastonediscount = 0;
174 174
 	}
175 175
 
176 176
 
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
      *  @param		int			$hideref			Do not show ref
187 187
      *  @return     int             			1=OK, 0=KO
188 188
      */
189
-	function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
189
+	function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
190 190
 	{
191 191
         // phpcs:enable
192
-		global $user,$langs,$conf,$mysoc,$hookmanager;
192
+		global $user, $langs, $conf, $mysoc, $hookmanager;
193 193
 
194
-		if (! is_object($outputlangs)) $outputlangs=$langs;
194
+		if (!is_object($outputlangs)) $outputlangs = $langs;
195 195
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
196
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
196
+		if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
197 197
 
198 198
 		// Load translation files required by the page
199 199
 		$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries"));
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 			if ($object->specimen)
207 207
 			{
208 208
 				$dir = $conf->expedition->dir_output."/receipt";
209
-				$file = $dir . "/SPECIMEN.pdf";
209
+				$file = $dir."/SPECIMEN.pdf";
210 210
 			}
211 211
 			else
212 212
 			{
213 213
 				$objectref = dol_sanitizeFileName($object->ref);
214
-				$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
215
-				$file = $dir . "/" . $objectref . ".pdf";
214
+				$dir = $conf->expedition->dir_output."/receipt/".$objectref;
215
+				$file = $dir."/".$objectref.".pdf";
216 216
 			}
217 217
 
218
-			if (! file_exists($dir))
218
+			if (!file_exists($dir))
219 219
 			{
220 220
 				if (dol_mkdir($dir) < 0)
221 221
 				{
222
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
222
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
223 223
 					return 0;
224 224
 				}
225 225
 			}
@@ -227,26 +227,26 @@  discard block
 block discarded – undo
227 227
 			if (file_exists($dir))
228 228
 			{
229 229
 				// Add pdfgeneration hook
230
-				if (! is_object($hookmanager))
230
+				if (!is_object($hookmanager))
231 231
 				{
232 232
 					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
233
-					$hookmanager=new HookManager($this->db);
233
+					$hookmanager = new HookManager($this->db);
234 234
 				}
235 235
 				$hookmanager->initHooks(array('pdfgeneration'));
236
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
236
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
237 237
 				global $action;
238
-				$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
238
+				$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
239 239
 
240 240
 				$nblines = count($object->lines);
241 241
 
242 242
 				// Create pdf instance
243
-				$pdf=pdf_getInstance($this->format);
244
-                $default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
245
-                $heightforinfotot = 30;	// Height reserved to output the info and total part
246
-		        $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
247
-	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
248
-	            if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
249
-                $pdf->SetAutoPageBreak(1,0);
243
+				$pdf = pdf_getInstance($this->format);
244
+                $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
245
+                $heightforinfotot = 30; // Height reserved to output the info and total part
246
+		        $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
247
+	            $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
248
+	            if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
249
+                $pdf->SetAutoPageBreak(1, 0);
250 250
 
251 251
                 if (class_exists('TCPDF'))
252 252
                 {
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
                 }
256 256
                 $pdf->SetFont(pdf_getPDFFont($outputlangs));
257 257
                 // Set path to the background PDF File
258
-                if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
258
+                if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
259 259
                 {
260 260
                     $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
261 261
                     $tplidx = $pdf->importPage(1);
262 262
                 }
263 263
 
264 264
 				// We get the shipment that is the origin of delivery receipt
265
-				$expedition=new Expedition($this->db);
265
+				$expedition = new Expedition($this->db);
266 266
 				$result = $expedition->fetch($object->origin_id);
267 267
 				// Now we get the order that is origin of shipment
268 268
 				$commande = new Commande($this->db);
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
 				{
271 271
 					$commande->fetch($expedition->origin_id);
272 272
 				}
273
-				$object->commande=$commande;	// We set order of shipment onto delivery.
273
+				$object->commande = $commande; // We set order of shipment onto delivery.
274 274
 				$object->commande->loadExpeditions();
275 275
 
276 276
 
277 277
 				$pdf->Open();
278
-				$pagenb=0;
279
-				$pdf->SetDrawColor(128,128,128);
278
+				$pagenb = 0;
279
+				$pdf->SetDrawColor(128, 128, 128);
280 280
 
281 281
 				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
282 282
 				$pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
283 283
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
284 284
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
285 285
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
286
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
286
+				if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
287 287
 
288
-				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
288
+				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
289 289
 
290 290
 				/*
291 291
 				// Positionne $this->atleastonediscount si on a au moins une remise
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
 
310 310
 				// New page
311 311
 				$pdf->AddPage();
312
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
312
+				if (!empty($tplidx)) $pdf->useTemplate($tplidx);
313 313
 				$pagenb++;
314 314
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
315
-				$pdf->SetFont('','', $default_font_size - 1);
316
-				$pdf->MultiCell(0, 3, '');		// Set interline to 3
317
-				$pdf->SetTextColor(0,0,0);
315
+				$pdf->SetFont('', '', $default_font_size - 1);
316
+				$pdf->MultiCell(0, 3, ''); // Set interline to 3
317
+				$pdf->SetTextColor(0, 0, 0);
318 318
 
319 319
 				$tab_top = 90;
320
-				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
320
+				$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
321 321
 				$tab_height = 130;
322 322
 				$tab_height_newpage = 150;
323 323
 
@@ -330,40 +330,40 @@  discard block
 block discarded – undo
330 330
 					{
331 331
 						$tab_top = 88;
332 332
 
333
-						$pdf->SetFont('','', $default_font_size - 1);
334
-						$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
333
+						$pdf->SetFont('', '', $default_font_size - 1);
334
+						$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
335 335
 						$nexY = $pdf->GetY();
336
-						$height_incoterms=$nexY-$tab_top;
336
+						$height_incoterms = $nexY - $tab_top;
337 337
 
338 338
 						// Rect prend une longueur en 3eme param
339
-						$pdf->SetDrawColor(192,192,192);
340
-						$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
339
+						$pdf->SetDrawColor(192, 192, 192);
340
+						$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
341 341
 
342
-						$tab_top = $nexY+6;
342
+						$tab_top = $nexY + 6;
343 343
 						$height_incoterms += 4;
344 344
 					}
345 345
 				}
346 346
 
347 347
 				// Affiche notes
348
-				if (! empty($object->note_public))
348
+				if (!empty($object->note_public))
349 349
 				{
350 350
 					$tab_top = 88 + $height_incoterms;
351 351
 
352
-					$pdf->SetFont('','', $default_font_size - 1);
353
-					$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
352
+					$pdf->SetFont('', '', $default_font_size - 1);
353
+					$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
354 354
 					$nexY = $pdf->GetY();
355
-					$height_note=$nexY-$tab_top;
355
+					$height_note = $nexY - $tab_top;
356 356
 
357 357
 					// Rect prend une longueur en 3eme param
358
-					$pdf->SetDrawColor(192,192,192);
359
-					$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
358
+					$pdf->SetDrawColor(192, 192, 192);
359
+					$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
360 360
 
361 361
 					$tab_height = $tab_height - $height_note;
362
-					$tab_top = $nexY+6;
362
+					$tab_top = $nexY + 6;
363 363
 				}
364 364
 				else
365 365
 				{
366
-					$height_note=0;
366
+					$height_note = 0;
367 367
 				}
368 368
 
369 369
 				$iniY = $tab_top + 11;
@@ -371,46 +371,46 @@  discard block
 block discarded – undo
371 371
 				$nexY = $tab_top + 11;
372 372
 
373 373
 				// Loop on each lines
374
-				for ($i = 0 ; $i < $nblines ; $i++)
374
+				for ($i = 0; $i < $nblines; $i++)
375 375
 				{
376 376
 					$curY = $nexY;
377
-					$pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
378
-					$pdf->SetTextColor(0,0,0);
377
+					$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
378
+					$pdf->SetTextColor(0, 0, 0);
379 379
 
380 380
 					$pdf->setTopMargin($tab_top_newpage);
381
-					$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
382
-					$pageposbefore=$pdf->getPage();
381
+					$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
382
+					$pageposbefore = $pdf->getPage();
383 383
 
384 384
 					// Description of product line
385
-					$curX = $this->posxdesc-1;
385
+					$curX = $this->posxdesc - 1;
386 386
 
387
-                    $showpricebeforepagebreak=1;
387
+                    $showpricebeforepagebreak = 1;
388 388
 
389 389
                     $pdf->startTransaction();
390
-                    pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc);
391
-                    $pageposafter=$pdf->getPage();
390
+                    pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm - $curX, 3, $curX, $curY, $hideref, $hidedesc);
391
+                    $pageposafter = $pdf->getPage();
392 392
                     if ($pageposafter > $pageposbefore)	// There is a pagebreak
393 393
                     {
394 394
                     	$pdf->rollbackTransaction(true);
395
-                    	$pageposafter=$pageposbefore;
395
+                    	$pageposafter = $pageposbefore;
396 396
                     	//print $pageposafter.'-'.$pageposbefore;exit;
397
-                    	$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
398
-                    	pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc);
399
-                    	$posyafter=$pdf->GetY();
400
-                    	if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
397
+                    	$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
398
+                    	pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm - $curX, 4, $curX, $curY, $hideref, $hidedesc);
399
+                    	$posyafter = $pdf->GetY();
400
+                    	if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))	// There is no space left for total+free text
401 401
                     	{
402
-                    		if ($i == ($nblines-1))	// No more lines, and no space left to show total, so we create a new page
402
+                    		if ($i == ($nblines - 1))	// No more lines, and no space left to show total, so we create a new page
403 403
                     		{
404
-                    			$pdf->AddPage('','',true);
405
-                    			if (! empty($tplidx)) $pdf->useTemplate($tplidx);
404
+                    			$pdf->AddPage('', '', true);
405
+                    			if (!empty($tplidx)) $pdf->useTemplate($tplidx);
406 406
                     			if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
407
-                    			$pdf->setPage($pageposafter+1);
407
+                    			$pdf->setPage($pageposafter + 1);
408 408
                     		}
409 409
                     	}
410 410
                     	else
411 411
                     	{
412 412
                     		// We found a page break
413
-                    		$showpricebeforepagebreak=0;
413
+                    		$showpricebeforepagebreak = 0;
414 414
                     	}
415 415
                     }
416 416
                     else	// No pagebreak
@@ -419,17 +419,17 @@  discard block
 block discarded – undo
419 419
                     }
420 420
 
421 421
 					$nexY = $pdf->GetY();
422
-                    $pageposafter=$pdf->getPage();
422
+                    $pageposafter = $pdf->getPage();
423 423
 					$pdf->setPage($pageposbefore);
424 424
 					$pdf->setTopMargin($this->marge_haute);
425
-					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
425
+					$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
426 426
 
427 427
 					// We suppose that a too long description is moved completely on next page
428 428
 					if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
429 429
 						$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
430 430
 					}
431 431
 
432
-					$pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
432
+					$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
433 433
 
434 434
 					/*
435 435
 					 // TVA
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 					// Remaining to ship
449 449
 					$pdf->SetXY($this->posxremainingqty, $curY);
450 450
 					$qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
451
-					$pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');
451
+					$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');
452 452
 					/*
453 453
 					 // Remise sur ligne
454 454
 					 $pdf->SetXY($this->posxdiscount, $curY);
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
 					 */
471 471
 
472 472
 					// Add line
473
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
473
+					if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
474 474
 					{
475 475
 						$pdf->setPage($pageposafter);
476
-						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
476
+						$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
477 477
 						//$pdf->SetDrawColor(190,190,200);
478
-						$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
478
+						$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
479 479
 						$pdf->SetLineStyle(array('dash'=>0));
480 480
 					}
481 481
 
482
-					$nexY+=2;    // Passe espace entre les lignes
482
+					$nexY += 2; // Passe espace entre les lignes
483 483
 
484 484
 					// Detect if some page were added automatically and output _tableau for past pages
485 485
 					while ($pagenb < $pageposafter)
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
 						{
494 494
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
495 495
 						}
496
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
496
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
497 497
 						$pagenb++;
498 498
 						$pdf->setPage($pagenb);
499
-						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
499
+						$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
500 500
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
501 501
 					}
502
-					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
502
+					if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
503 503
 					{
504 504
 						if ($pagenb == 1)
505 505
 						{
@@ -509,10 +509,10 @@  discard block
 block discarded – undo
509 509
 						{
510 510
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
511 511
 						}
512
-						$this->_pagefoot($pdf,$object,$outputlangs,1);
512
+						$this->_pagefoot($pdf, $object, $outputlangs, 1);
513 513
 						// New page
514 514
 						$pdf->AddPage();
515
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
515
+						if (!empty($tplidx)) $pdf->useTemplate($tplidx);
516 516
 						$pagenb++;
517 517
 						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
518 518
 					}
@@ -522,21 +522,21 @@  discard block
 block discarded – undo
522 522
 				if ($pagenb == 1)
523 523
 				{
524 524
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
525
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
525
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
526 526
 				}
527 527
 				else
528 528
 				{
529 529
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
530
-					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
530
+					$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
531 531
 				}
532 532
 
533 533
 				// Affiche zone infos
534 534
 				$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
535 535
 
536 536
 				// Pied de page
537
-				$this->_pagefoot($pdf,$object,$outputlangs);
537
+				$this->_pagefoot($pdf, $object, $outputlangs);
538 538
 
539
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
539
+				if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
540 540
 
541 541
 				// Check product remaining to be delivered
542 542
 				// TODO doit etre modifie
@@ -601,34 +601,34 @@  discard block
 block discarded – undo
601 601
 
602 602
 				$pdf->Close();
603 603
 
604
-				$pdf->Output($file,'F');
604
+				$pdf->Output($file, 'F');
605 605
 
606 606
 				// Add pdfgeneration hook
607
-				if (! is_object($hookmanager))
607
+				if (!is_object($hookmanager))
608 608
 				{
609 609
 					include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
610
-					$hookmanager=new HookManager($this->db);
610
+					$hookmanager = new HookManager($this->db);
611 611
 				}
612 612
 				$hookmanager->initHooks(array('pdfgeneration'));
613
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
613
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
614 614
 				global $action;
615
-				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
615
+				$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
616 616
 
617
-				if (! empty($conf->global->MAIN_UMASK))
617
+				if (!empty($conf->global->MAIN_UMASK))
618 618
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
619 619
 
620 620
 				$this->result = array('fullpath'=>$file);
621 621
 
622
-				return 1;	// pas d'erreur
622
+				return 1; // pas d'erreur
623 623
 			}
624 624
 			else
625 625
 			{
626
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
626
+				$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
627 627
 				return 0;
628 628
 			}
629 629
 		}
630 630
 
631
-		$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
631
+		$this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR");
632 632
 		return 0;
633 633
 	}
634 634
 
@@ -645,20 +645,20 @@  discard block
 block discarded – undo
645 645
 	function _tableau_info(&$pdf, $object, $posy, $outputlangs)
646 646
 	{
647 647
         // phpcs:enable
648
-		global $conf,$mysoc;
648
+		global $conf, $mysoc;
649 649
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
650 650
 
651
-		$pdf->SetFont('','', $default_font_size);
651
+		$pdf->SetFont('', '', $default_font_size);
652 652
 		$pdf->SetXY($this->marge_gauche, $posy);
653 653
 
654
-		$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
654
+		$larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
655 655
 		$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
656 656
 		$pdf->SetXY($this->marge_gauche + 2, $posy + 2);
657
-		$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
657
+		$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":", '', 'L');
658 658
 
659
-		$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
660
-		$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
661
-		$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
659
+		$pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25);
660
+		$pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
661
+		$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L');
662 662
 	}
663 663
 
664 664
 	/**
@@ -673,56 +673,56 @@  discard block
 block discarded – undo
673 673
 	 *   @param		int			$hidebottom		Hide bottom bar of array
674 674
 	 *   @return	void
675 675
 	 */
676
-	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
676
+	function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
677 677
 	{
678
-		global $conf,$mysoc;
678
+		global $conf, $mysoc;
679 679
 
680 680
 		// Force to disable hidetop and hidebottom
681
-		$hidebottom=0;
682
-		if ($hidetop) $hidetop=-1;
681
+		$hidebottom = 0;
682
+		if ($hidetop) $hidetop = -1;
683 683
 
684 684
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
685 685
 
686 686
 		// Amount in (at tab_top - 1)
687
-		$pdf->SetTextColor(0,0,0);
688
-		$pdf->SetFont('','', $default_font_size - 2);
687
+		$pdf->SetTextColor(0, 0, 0);
688
+		$pdf->SetFont('', '', $default_font_size - 2);
689 689
 
690 690
 		// Output Rec
691
-		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);	// Rect prend une longueur en 3eme param et 4eme param
691
+		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
692 692
 
693 693
 		if (empty($hidetop))
694 694
 		{
695
-			$pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10);
695
+			$pdf->line($this->marge_gauche, $tab_top + 10, $this->page_largeur - $this->marge_droite, $tab_top + 10);
696 696
 		}
697 697
 
698
-		$pdf->SetDrawColor(128,128,128);
699
-		$pdf->SetFont('','', $default_font_size - 1);
698
+		$pdf->SetDrawColor(128, 128, 128);
699
+		$pdf->SetFont('', '', $default_font_size - 1);
700 700
 
701 701
 		if (empty($hidetop))
702 702
 		{
703
-			$pdf->SetXY($this->posxdesc-1, $tab_top+1);
704
-			$pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
703
+			$pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
704
+			$pdf->MultiCell($this->posxcomm - $this->posxdesc, 2, $outputlangs->transnoentities("Designation"), '', 'L');
705 705
 		}
706 706
 
707 707
 		// Modif SEB pour avoir une col en plus pour les commentaires clients
708 708
 		$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
709 709
 		if (empty($hidetop)) {
710
-			$pdf->SetXY($this->posxcomm, $tab_top+1);
711
-			$pdf->MultiCell($this->posxqty - $this->posxcomm,2, $outputlangs->transnoentities("Comments"),'','L');
710
+			$pdf->SetXY($this->posxcomm, $tab_top + 1);
711
+			$pdf->MultiCell($this->posxqty - $this->posxcomm, 2, $outputlangs->transnoentities("Comments"), '', 'L');
712 712
 		}
713 713
 
714 714
 		// Qty
715 715
 		$pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height);
716 716
 		if (empty($hidetop)) {
717
-			$pdf->SetXY($this->posxqty, $tab_top+1);
718
-			$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"),'','R');
717
+			$pdf->SetXY($this->posxqty, $tab_top + 1);
718
+			$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShippedShort"), '', 'R');
719 719
 		}
720 720
 
721 721
 		// Remain to ship
722 722
 		$pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height);
723 723
 		if (empty($hidetop)) {
724
-			$pdf->SetXY($this->posxremainingqty, $tab_top+1);
725
-			$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"),'','R');
724
+			$pdf->SetXY($this->posxremainingqty, $tab_top + 1);
725
+			$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShipShort"), '', 'R');
726 726
 		}
727 727
 	}
728 728
 
@@ -737,77 +737,77 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
739 739
 	{
740
-		global $conf,$langs,$hookmanager;
740
+		global $conf, $langs, $hookmanager;
741 741
 
742 742
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
743 743
 
744
-		pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
744
+		pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
745 745
 
746 746
 		// Show Draft Watermark
747
-		if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
747
+		if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK)))
748 748
 		{
749
-			pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
749
+			pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
750 750
 		}
751 751
 
752
-		$pdf->SetTextColor(0,0,60);
753
-		$pdf->SetFont('','B', $default_font_size + 3);
752
+		$pdf->SetTextColor(0, 0, 60);
753
+		$pdf->SetFont('', 'B', $default_font_size + 3);
754 754
 
755
-		$posy=$this->marge_haute;
756
-		$posx=$this->page_largeur-$this->marge_droite-100;
755
+		$posy = $this->marge_haute;
756
+		$posx = $this->page_largeur - $this->marge_droite - 100;
757 757
 
758
-		$pdf->SetXY($this->marge_gauche,$posy);
758
+		$pdf->SetXY($this->marge_gauche, $posy);
759 759
 
760 760
 		// Logo
761
-		$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
761
+		$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
762 762
 		if ($this->emetteur->logo)
763 763
 		{
764 764
 			if (is_readable($logo))
765 765
 			{
766
-			    $height=pdf_getHeightForLogo($logo);
767
-			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
766
+			    $height = pdf_getHeightForLogo($logo);
767
+			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
768 768
 			}
769 769
 			else
770 770
 			{
771
-				$pdf->SetTextColor(200,0,0);
772
-				$pdf->SetFont('','B', $default_font_size - 2);
773
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
771
+				$pdf->SetTextColor(200, 0, 0);
772
+				$pdf->SetFont('', 'B', $default_font_size - 2);
773
+				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
774 774
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
775 775
 			}
776 776
 		}
777 777
 		else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
778 778
 
779
-		$pdf->SetFont('','B', $default_font_size + 2);
780
-		$pdf->SetXY($posx,$posy);
781
-		$pdf->SetTextColor(0,0,60);
779
+		$pdf->SetFont('', 'B', $default_font_size + 2);
780
+		$pdf->SetXY($posx, $posy);
781
+		$pdf->SetTextColor(0, 0, 60);
782 782
 		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
783 783
 
784
-		$pdf->SetFont('','',$default_font_size + 2);
784
+		$pdf->SetFont('', '', $default_font_size + 2);
785 785
 
786
-		$posy+=5;
787
-		$pdf->SetXY($posx,$posy);
788
-		$pdf->SetTextColor(0,0,60);
786
+		$posy += 5;
787
+		$pdf->SetXY($posx, $posy);
788
+		$pdf->SetTextColor(0, 0, 60);
789 789
 		if ($object->date_valid)
790 790
 		{
791
-			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,"%d %b %Y",false,$outputlangs,true), '', 'R');
791
+			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R');
792 792
 		}
793 793
 		else
794 794
 		{
795
-			$pdf->SetTextColor(255,0,0);
795
+			$pdf->SetTextColor(255, 0, 0);
796 796
 			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
797
-			$pdf->SetTextColor(0,0,60);
797
+			$pdf->SetTextColor(0, 0, 60);
798 798
 		}
799 799
 
800 800
 		if ($object->thirdparty->code_client)
801 801
 		{
802
-			$posy+=5;
803
-			$pdf->SetXY($posx,$posy);
804
-			$pdf->SetTextColor(0,0,60);
805
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
802
+			$posy += 5;
803
+			$pdf->SetXY($posx, $posy);
804
+			$pdf->SetTextColor(0, 0, 60);
805
+			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
806 806
 		}
807 807
 
808
-		$pdf->SetTextColor(0,0,60);
808
+		$pdf->SetTextColor(0, 0, 60);
809 809
 
810
-		$posy+=2;
810
+		$posy += 2;
811 811
 
812 812
 		// Show list of linked objects
813 813
 		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
@@ -815,51 +815,51 @@  discard block
 block discarded – undo
815 815
 		if ($showaddress)
816 816
 		{
817 817
 			// Sender properties
818
-			$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur, $object->thirdparty, '', 0, 'source', $object);
818
+			$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
819 819
 
820 820
 			// Show sender
821
-			$posy=42;
822
-			$posx=$this->marge_gauche;
823
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
824
-			$hautcadre=40;
821
+			$posy = 42;
822
+			$posx = $this->marge_gauche;
823
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
824
+			$hautcadre = 40;
825 825
 
826 826
 			// Show sender frame
827
-			$pdf->SetTextColor(0,0,0);
828
-			$pdf->SetFont('','', $default_font_size - 2);
829
-			$pdf->SetXY($posx,$posy-5);
830
-			$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
831
-			$pdf->SetXY($posx,$posy);
832
-			$pdf->SetFillColor(230,230,230);
827
+			$pdf->SetTextColor(0, 0, 0);
828
+			$pdf->SetFont('', '', $default_font_size - 2);
829
+			$pdf->SetXY($posx, $posy - 5);
830
+			$pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
831
+			$pdf->SetXY($posx, $posy);
832
+			$pdf->SetFillColor(230, 230, 230);
833 833
 			$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
834
-			$pdf->SetTextColor(0,0,60);
834
+			$pdf->SetTextColor(0, 0, 60);
835 835
 
836 836
 			// Show sender name
837
-			$pdf->SetXY($posx+2,$posy+3);
838
-			$pdf->SetFont('','B',$default_font_size);
837
+			$pdf->SetXY($posx + 2, $posy + 3);
838
+			$pdf->SetFont('', 'B', $default_font_size);
839 839
 			$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
840
-			$posy=$pdf->getY();
840
+			$posy = $pdf->getY();
841 841
 
842 842
 			// Show sender information
843
-			$pdf->SetXY($posx+2,$posy);
844
-			$pdf->SetFont('','', $default_font_size - 1);
843
+			$pdf->SetXY($posx + 2, $posy);
844
+			$pdf->SetFont('', '', $default_font_size - 1);
845 845
 			$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
846 846
 
847 847
 			// Client destinataire
848
-			$posy=42;
849
-			$posx=102;
850
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
851
-			$pdf->SetTextColor(0,0,0);
852
-			$pdf->SetFont('','', $default_font_size - 2);
853
-			$pdf->SetXY($posx,$posy-5);
854
-			$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
848
+			$posy = 42;
849
+			$posx = 102;
850
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
851
+			$pdf->SetTextColor(0, 0, 0);
852
+			$pdf->SetFont('', '', $default_font_size - 2);
853
+			$pdf->SetXY($posx, $posy - 5);
854
+			$pdf->MultiCell(80, 5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
855 855
 
856 856
 			// If SHIPPING contact defined on order, we use it
857
-			$usecontact=false;
858
-			$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
857
+			$usecontact = false;
858
+			$arrayidcontact = $object->commande->getIdContact('external', 'SHIPPING');
859 859
 			if (count($arrayidcontact) > 0)
860 860
 			{
861
-				$usecontact=true;
862
-				$result=$object->fetch_contact($arrayidcontact[0]);
861
+				$usecontact = true;
862
+				$result = $object->fetch_contact($arrayidcontact[0]);
863 863
 			}
864 864
 
865 865
 			//Recipient name
@@ -870,38 +870,38 @@  discard block
 block discarded – undo
870 870
 				$thirdparty = $object->thirdparty;
871 871
 			}
872 872
 
873
-			$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
873
+			$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
874 874
 
875
-			$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
875
+			$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
876 876
 
877 877
 			// Show recipient
878
-			$widthrecbox=100;
879
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
880
-			$posy=42;
881
-			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
882
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
878
+			$widthrecbox = 100;
879
+			if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
880
+			$posy = 42;
881
+			$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
882
+			if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
883 883
 
884 884
 			// Show recipient frame
885
-			$pdf->SetTextColor(0,0,0);
886
-			$pdf->SetFont('','', $default_font_size - 2);
887
-			$pdf->SetXY($posx+2,$posy-5);
885
+			$pdf->SetTextColor(0, 0, 0);
886
+			$pdf->SetFont('', '', $default_font_size - 2);
887
+			$pdf->SetXY($posx + 2, $posy - 5);
888 888
 			//$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
889 889
 			$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
890 890
 
891 891
 			// Show recipient name
892
-			$pdf->SetXY($posx+2,$posy+3);
893
-			$pdf->SetFont('','B', $default_font_size);
892
+			$pdf->SetXY($posx + 2, $posy + 3);
893
+			$pdf->SetFont('', 'B', $default_font_size);
894 894
 			$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
895 895
 
896 896
 			$posy = $pdf->getY();
897 897
 
898 898
 			// Show recipient information
899
-			$pdf->SetFont('','', $default_font_size - 1);
900
-			$pdf->SetXY($posx+2,$posy);
899
+			$pdf->SetFont('', '', $default_font_size - 1);
900
+			$pdf->SetXY($posx + 2, $posy);
901 901
 			$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
902 902
 		}
903 903
 
904
-		$pdf->SetTextColor(0,0,60);
904
+		$pdf->SetTextColor(0, 0, 60);
905 905
 	}
906 906
 
907 907
 	/**
@@ -913,10 +913,10 @@  discard block
 block discarded – undo
913 913
 	 *      @param	int			$hidefreetext		1=Hide free text
914 914
 	 *      @return	int								Return height of bottom margin including footer text
915 915
 	 */
916
-	function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
916
+	function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
917 917
 	{
918 918
 		global $conf;
919
-		$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
920
-		return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
919
+		$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
920
+		return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
921 921
 	}
922 922
 }
Please login to merge, or discard this patch.
Braces   +77 added lines, -43 removed lines patch added patch discarded remove patch
@@ -147,7 +147,10 @@  discard block
 block discarded – undo
147 147
 
148 148
 		// Get source company
149 149
 		$this->emetteur=$mysoc;
150
-		if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default, if was not defined
150
+		if (empty($this->emetteur->country_code)) {
151
+		    $this->emetteur->country_code=substr($langs->defaultlang,-2);
152
+		}
153
+		// By default, if was not defined
151 154
 
152 155
 		// Define position of columns
153 156
 		$this->posxdesc=$this->marge_gauche+1;
@@ -158,9 +161,11 @@  discard block
 block discarded – undo
158 161
 		$this->posxremainingqty=185;
159 162
 		//$this->posxdiscount=162;
160 163
 		//$this->postotalht=174;
161
-		if ($this->page_largeur < 210) // To work with US executive format
164
+		if ($this->page_largeur < 210) {
165
+		    // To work with US executive format
162 166
 		{
163 167
 			$this->posxcomm-=20;
168
+		}
164 169
 			//$this->posxtva-=20;
165 170
 			//$this->posxup-=20;
166 171
 			$this->posxqty-=20;
@@ -191,9 +196,13 @@  discard block
 block discarded – undo
191 196
         // phpcs:enable
192 197
 		global $user,$langs,$conf,$mysoc,$hookmanager;
193 198
 
194
-		if (! is_object($outputlangs)) $outputlangs=$langs;
199
+		if (! is_object($outputlangs)) {
200
+		    $outputlangs=$langs;
201
+		}
195 202
 		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
196
-		if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
203
+		if (! empty($conf->global->MAIN_USE_FPDF)) {
204
+		    $outputlangs->charset_output='ISO-8859-1';
205
+		}
197 206
 
198 207
 		// Load translation files required by the page
199 208
 		$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries"));
@@ -207,8 +216,7 @@  discard block
 block discarded – undo
207 216
 			{
208 217
 				$dir = $conf->expedition->dir_output."/receipt";
209 218
 				$file = $dir . "/SPECIMEN.pdf";
210
-			}
211
-			else
219
+			} else
212 220
 			{
213 221
 				$objectref = dol_sanitizeFileName($object->ref);
214 222
 				$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
@@ -245,7 +253,9 @@  discard block
 block discarded – undo
245 253
                 $heightforinfotot = 30;	// Height reserved to output the info and total part
246 254
 		        $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
247 255
 	            $heightforfooter = $this->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
248
-	            if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
256
+	            if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) {
257
+	                $heightforfooter+= 6;
258
+	            }
249 259
                 $pdf->SetAutoPageBreak(1,0);
250 260
 
251 261
                 if (class_exists('TCPDF'))
@@ -283,7 +293,9 @@  discard block
 block discarded – undo
283 293
 				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
284 294
 				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
285 295
 				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
286
-				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
296
+				if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
297
+				    $pdf->SetCompression(false);
298
+				}
287 299
 
288 300
 				$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
289 301
 
@@ -309,7 +321,9 @@  discard block
 block discarded – undo
309 321
 
310 322
 				// New page
311 323
 				$pdf->AddPage();
312
-				if (! empty($tplidx)) $pdf->useTemplate($tplidx);
324
+				if (! empty($tplidx)) {
325
+				    $pdf->useTemplate($tplidx);
326
+				}
313 327
 				$pagenb++;
314 328
 				$this->_pagehead($pdf, $object, 1, $outputlangs);
315 329
 				$pdf->SetFont('','', $default_font_size - 1);
@@ -360,8 +374,7 @@  discard block
 block discarded – undo
360 374
 
361 375
 					$tab_height = $tab_height - $height_note;
362 376
 					$tab_top = $nexY+6;
363
-				}
364
-				else
377
+				} else
365 378
 				{
366 379
 					$height_note=0;
367 380
 				}
@@ -389,31 +402,37 @@  discard block
 block discarded – undo
389 402
                     $pdf->startTransaction();
390 403
                     pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc);
391 404
                     $pageposafter=$pdf->getPage();
392
-                    if ($pageposafter > $pageposbefore)	// There is a pagebreak
405
+                    if ($pageposafter > $pageposbefore) {
406
+                        // There is a pagebreak
393 407
                     {
394 408
                     	$pdf->rollbackTransaction(true);
409
+                    }
395 410
                     	$pageposafter=$pageposbefore;
396 411
                     	//print $pageposafter.'-'.$pageposbefore;exit;
397 412
                     	$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
398 413
                     	pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc);
399 414
                     	$posyafter=$pdf->GetY();
400
-                    	if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
415
+                    	if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) {
416
+                    	    // There is no space left for total+free text
401 417
                     	{
402 418
                     		if ($i == ($nblines-1))	// No more lines, and no space left to show total, so we create a new page
403 419
                     		{
404 420
                     			$pdf->AddPage('','',true);
405
-                    			if (! empty($tplidx)) $pdf->useTemplate($tplidx);
406
-                    			if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
421
+                    	}
422
+                    			if (! empty($tplidx)) {
423
+                    			    $pdf->useTemplate($tplidx);
424
+                    			}
425
+                    			if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
426
+                    			    $this->_pagehead($pdf, $object, 0, $outputlangs);
427
+                    			}
407 428
                     			$pdf->setPage($pageposafter+1);
408 429
                     		}
409
-                    	}
410
-                    	else
430
+                    	} else
411 431
                     	{
412 432
                     		// We found a page break
413 433
                     		$showpricebeforepagebreak=0;
414 434
                     	}
415
-                    }
416
-                    else	// No pagebreak
435
+                    } else	// No pagebreak
417 436
                     {
418 437
                     	$pdf->commitTransaction();
419 438
                     }
@@ -488,8 +507,7 @@  discard block
 block discarded – undo
488 507
 						if ($pagenb == 1)
489 508
 						{
490 509
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
491
-						}
492
-						else
510
+						} else
493 511
 						{
494 512
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
495 513
 						}
@@ -497,24 +515,29 @@  discard block
 block discarded – undo
497 515
 						$pagenb++;
498 516
 						$pdf->setPage($pagenb);
499 517
 						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
500
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
518
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
519
+						    $this->_pagehead($pdf, $object, 0, $outputlangs);
520
+						}
501 521
 					}
502 522
 					if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
503 523
 					{
504 524
 						if ($pagenb == 1)
505 525
 						{
506 526
 							$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
507
-						}
508
-						else
527
+						} else
509 528
 						{
510 529
 							$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
511 530
 						}
512 531
 						$this->_pagefoot($pdf,$object,$outputlangs,1);
513 532
 						// New page
514 533
 						$pdf->AddPage();
515
-						if (! empty($tplidx)) $pdf->useTemplate($tplidx);
534
+						if (! empty($tplidx)) {
535
+						    $pdf->useTemplate($tplidx);
536
+						}
516 537
 						$pagenb++;
517
-						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
538
+						if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
539
+						    $this->_pagehead($pdf, $object, 0, $outputlangs);
540
+						}
518 541
 					}
519 542
 				}
520 543
 
@@ -523,8 +546,7 @@  discard block
 block discarded – undo
523 546
 				{
524 547
 					$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
525 548
 					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
526
-				}
527
-				else
549
+				} else
528 550
 				{
529 551
 					$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
530 552
 					$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
@@ -536,7 +558,9 @@  discard block
 block discarded – undo
536 558
 				// Pied de page
537 559
 				$this->_pagefoot($pdf,$object,$outputlangs);
538 560
 
539
-				if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
561
+				if (method_exists($pdf,'AliasNbPages')) {
562
+				    $pdf->AliasNbPages();
563
+				}
540 564
 
541 565
 				// Check product remaining to be delivered
542 566
 				// TODO doit etre modifie
@@ -614,14 +638,14 @@  discard block
 block discarded – undo
614 638
 				global $action;
615 639
 				$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
616 640
 
617
-				if (! empty($conf->global->MAIN_UMASK))
618
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
641
+				if (! empty($conf->global->MAIN_UMASK)) {
642
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
643
+				}
619 644
 
620 645
 				$this->result = array('fullpath'=>$file);
621 646
 
622 647
 				return 1;	// pas d'erreur
623
-			}
624
-			else
648
+			} else
625 649
 			{
626 650
 				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
627 651
 				return 0;
@@ -679,7 +703,9 @@  discard block
 block discarded – undo
679 703
 
680 704
 		// Force to disable hidetop and hidebottom
681 705
 		$hidebottom=0;
682
-		if ($hidetop) $hidetop=-1;
706
+		if ($hidetop) {
707
+		    $hidetop=-1;
708
+		}
683 709
 
684 710
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
685 711
 
@@ -765,16 +791,16 @@  discard block
 block discarded – undo
765 791
 			{
766 792
 			    $height=pdf_getHeightForLogo($logo);
767 793
 			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
768
-			}
769
-			else
794
+			} else
770 795
 			{
771 796
 				$pdf->SetTextColor(200,0,0);
772 797
 				$pdf->SetFont('','B', $default_font_size - 2);
773 798
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
774 799
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
775 800
 			}
801
+		} else {
802
+		    $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
776 803
 		}
777
-		else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
778 804
 
779 805
 		$pdf->SetFont('','B', $default_font_size + 2);
780 806
 		$pdf->SetXY($posx,$posy);
@@ -789,8 +815,7 @@  discard block
 block discarded – undo
789 815
 		if ($object->date_valid)
790 816
 		{
791 817
 			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,"%d %b %Y",false,$outputlangs,true), '', 'R');
792
-		}
793
-		else
818
+		} else
794 819
 		{
795 820
 			$pdf->SetTextColor(255,0,0);
796 821
 			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
@@ -820,7 +845,9 @@  discard block
 block discarded – undo
820 845
 			// Show sender
821 846
 			$posy=42;
822 847
 			$posx=$this->marge_gauche;
823
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
848
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
849
+			    $posx=$this->page_largeur-$this->marge_droite-80;
850
+			}
824 851
 			$hautcadre=40;
825 852
 
826 853
 			// Show sender frame
@@ -847,7 +874,9 @@  discard block
 block discarded – undo
847 874
 			// Client destinataire
848 875
 			$posy=42;
849 876
 			$posx=102;
850
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
877
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
878
+			    $posx=$this->marge_gauche;
879
+			}
851 880
 			$pdf->SetTextColor(0,0,0);
852 881
 			$pdf->SetFont('','', $default_font_size - 2);
853 882
 			$pdf->SetXY($posx,$posy-5);
@@ -876,10 +905,15 @@  discard block
 block discarded – undo
876 905
 
877 906
 			// Show recipient
878 907
 			$widthrecbox=100;
879
-			if ($this->page_largeur < 210) $widthrecbox=84;	// To work with US executive format
908
+			if ($this->page_largeur < 210) {
909
+			    $widthrecbox=84;
910
+			}
911
+			// To work with US executive format
880 912
 			$posy=42;
881 913
 			$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
882
-			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
914
+			if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
915
+			    $posx=$this->marge_gauche;
916
+			}
883 917
 
884 918
 			// Show recipient frame
885 919
 			$pdf->SetTextColor(0,0,0);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/livraison/modules_livraison.php 3 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -36,32 +36,32 @@  discard block
 block discarded – undo
36 36
  */
37 37
 abstract class ModelePDFDeliveryOrder extends CommonDocGenerator
38 38
 {
39
-	/**
40
-	 * @var string Error code (or message)
41
-	 */
42
-	public $error='';
39
+    /**
40
+     * @var string Error code (or message)
41
+     */
42
+    public $error='';
43 43
 
44 44
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
45
-	/**
46
-	 *  Return list of active generation modules
47
-	 *
45
+    /**
46
+     *  Return list of active generation modules
47
+     *
48 48
      *  @param	DoliDB	$db     			Database handler
49 49
      *  @param  integer	$maxfilenamelength  Max length of value to show
50 50
      *  @return	array						List of templates
51
-	 */
52
-	static function liste_modeles($db,$maxfilenamelength=0)
53
-	{
51
+     */
52
+    static function liste_modeles($db,$maxfilenamelength=0)
53
+    {
54 54
         // phpcs:enable
55
-		global $conf;
55
+        global $conf;
56 56
 
57
-		$type='delivery';
58
-		$liste=array();
57
+        $type='delivery';
58
+        $liste=array();
59 59
 
60
-		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
61
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
60
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
61
+        $liste=getListOfModels($db,$type,$maxfilenamelength);
62 62
 
63
-		return $liste;
64
-	}
63
+        return $liste;
64
+    }
65 65
 }
66 66
 
67 67
 
@@ -72,83 +72,83 @@  discard block
 block discarded – undo
72 72
  */
73 73
 abstract class ModeleNumRefDeliveryOrder
74 74
 {
75
-	/**
76
-	 * @var string Error code (or message)
77
-	 */
78
-	public $error='';
79
-
80
-	/**
81
-	 * Return if a module can be used or not
82
-	 *
83
-	 * @return		boolean     true if module can be used
84
-	 */
85
-	function isEnabled()
86
-	{
87
-		return true;
88
-	}
89
-
90
-	/**
91
-	 * Renvoi la description par defaut du modele de numerotation
92
-	 *
93
-	 * @return     string      Texte descripif
94
-	 */
95
-	function info()
96
-	{
97
-		global $langs;
98
-		$langs->load("deliveries");
99
-		return $langs->trans("NoDescription");
100
-	}
101
-
102
-	/**
103
-	 * Renvoi un exemple de numerotation
104
-	 *
105
-	 * @return     string      Example
106
-	 */
107
-	function getExample()
108
-	{
109
-		global $langs;
110
-		$langs->load("deliveries");
111
-		return $langs->trans("NoExample");
112
-	}
113
-
114
-	/**
115
-	 * Test si les numeros deja en vigueur dans la base ne provoquent pas d
116
-	 * de conflits qui empechera cette numerotation de fonctionner.
117
-	 *
118
-	 * @return     boolean     false si conflit, true si ok
119
-	 */
120
-	function canBeActivated()
121
-	{
122
-		return true;
123
-	}
124
-
125
-	/**
126
-	 * Renvoi prochaine valeur attribuee
127
-	 *
128
-	 *	@param	Societe		$objsoc     	Object third party
129
-	 *  @param  Object		$object			Object delivery
130
-	 *	@return	string						Valeur
131
-	 */
132
-	function getNextValue($objsoc, $object)
133
-	{
134
-		global $langs;
135
-		return $langs->trans("NotAvailable");
136
-	}
137
-
138
-	/**
139
-	 * Renvoi version du module numerotation
140
-	 *
141
-	 * @return     string      Valeur
142
-	 */
143
-	function getVersion()
144
-	{
145
-		global $langs;
146
-		$langs->load("admin");
147
-
148
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
149
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
150
-		if ($this->version == 'dolibarr') return DOL_VERSION;
151
-		if ($this->version) return $this->version;
152
-		return $langs->trans("NotAvailable");
153
-	}
75
+    /**
76
+     * @var string Error code (or message)
77
+     */
78
+    public $error='';
79
+
80
+    /**
81
+     * Return if a module can be used or not
82
+     *
83
+     * @return		boolean     true if module can be used
84
+     */
85
+    function isEnabled()
86
+    {
87
+        return true;
88
+    }
89
+
90
+    /**
91
+     * Renvoi la description par defaut du modele de numerotation
92
+     *
93
+     * @return     string      Texte descripif
94
+     */
95
+    function info()
96
+    {
97
+        global $langs;
98
+        $langs->load("deliveries");
99
+        return $langs->trans("NoDescription");
100
+    }
101
+
102
+    /**
103
+     * Renvoi un exemple de numerotation
104
+     *
105
+     * @return     string      Example
106
+     */
107
+    function getExample()
108
+    {
109
+        global $langs;
110
+        $langs->load("deliveries");
111
+        return $langs->trans("NoExample");
112
+    }
113
+
114
+    /**
115
+     * Test si les numeros deja en vigueur dans la base ne provoquent pas d
116
+     * de conflits qui empechera cette numerotation de fonctionner.
117
+     *
118
+     * @return     boolean     false si conflit, true si ok
119
+     */
120
+    function canBeActivated()
121
+    {
122
+        return true;
123
+    }
124
+
125
+    /**
126
+     * Renvoi prochaine valeur attribuee
127
+     *
128
+     *	@param	Societe		$objsoc     	Object third party
129
+     *  @param  Object		$object			Object delivery
130
+     *	@return	string						Valeur
131
+     */
132
+    function getNextValue($objsoc, $object)
133
+    {
134
+        global $langs;
135
+        return $langs->trans("NotAvailable");
136
+    }
137
+
138
+    /**
139
+     * Renvoi version du module numerotation
140
+     *
141
+     * @return     string      Valeur
142
+     */
143
+    function getVersion()
144
+    {
145
+        global $langs;
146
+        $langs->load("admin");
147
+
148
+        if ($this->version == 'development') return $langs->trans("VersionDevelopment");
149
+        if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
150
+        if ($this->version == 'dolibarr') return DOL_VERSION;
151
+        if ($this->version) return $this->version;
152
+        return $langs->trans("NotAvailable");
153
+    }
154 154
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * @var string Error code (or message)
41 41
 	 */
42
-	public $error='';
42
+	public $error = '';
43 43
 
44 44
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
45 45
 	/**
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
      *  @param  integer	$maxfilenamelength  Max length of value to show
50 50
      *  @return	array						List of templates
51 51
 	 */
52
-	static function liste_modeles($db,$maxfilenamelength=0)
52
+	static function liste_modeles($db, $maxfilenamelength = 0)
53 53
 	{
54 54
         // phpcs:enable
55 55
 		global $conf;
56 56
 
57
-		$type='delivery';
58
-		$liste=array();
57
+		$type = 'delivery';
58
+		$liste = array();
59 59
 
60 60
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
61
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
61
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
62 62
 
63 63
 		return $liste;
64 64
 	}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	/**
76 76
 	 * @var string Error code (or message)
77 77
 	 */
78
-	public $error='';
78
+	public $error = '';
79 79
 
80 80
 	/**
81 81
 	 * Return if a module can be used or not
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -142,10 +142,18 @@
 block discarded – undo
142 142
 		global $langs;
143 143
 		$langs->load("admin");
144 144
 
145
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
146
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
147
-		if ($this->version == 'dolibarr') return DOL_VERSION;
148
-		if ($this->version) return $this->version;
145
+		if ($this->version == 'development') {
146
+		    return $langs->trans("VersionDevelopment");
147
+		}
148
+		if ($this->version == 'experimental') {
149
+		    return $langs->trans("VersionExperimental");
150
+		}
151
+		if ($this->version == 'dolibarr') {
152
+		    return DOL_VERSION;
153
+		}
154
+		if ($this->version) {
155
+		    return $this->version;
156
+		}
149 157
 		return $langs->trans("NotAvailable");
150 158
 	}
151 159
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/livraison/mod_livraison_saphir.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -31,28 +31,28 @@  discard block
 block discarded – undo
31 31
  */
32 32
 class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
33 33
 {
34
-	/**
34
+    /**
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
-	/**
41
-	 * @var string Error message
42
-	 */
43
-	public $error = '';
40
+    /**
41
+     * @var string Error message
42
+     */
43
+    public $error = '';
44 44
 
45
-	/**
46
-	 * @var string Nom du modele
47
-	 * @deprecated
48
-	 * @see name
49
-	 */
50
-	public $nom='Saphir';
45
+    /**
46
+     * @var string Nom du modele
47
+     * @deprecated
48
+     * @see name
49
+     */
50
+    public $nom='Saphir';
51 51
 
52
-	/**
53
-	 * @var string model name
54
-	 */
55
-	public $name='Saphir';
52
+    /**
53
+     * @var string model name
54
+     */
55
+    public $name='Saphir';
56 56
 
57 57
 
58 58
     /**
@@ -60,39 +60,39 @@  discard block
 block discarded – undo
60 60
      *
61 61
      *  @return     string      Texte descripif
62 62
      */
63
-	function info()
64
-	{
65
-    	global $conf, $langs;
63
+    function info()
64
+    {
65
+        global $conf, $langs;
66 66
 
67
-		$langs->load("bills");
67
+        $langs->load("bills");
68 68
 
69
-		$form = new Form($this->db);
69
+        $form = new Form($this->db);
70 70
 
71
-		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
72
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
73
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
74
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
75
-		$texte.= '<input type="hidden" name="maskconstdelivery" value="LIVRAISON_SAPHIR_MASK">';
76
-		$texte.= '<table class="nobordernopadding" width="100%">';
71
+        $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
72
+        $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
73
+        $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
74
+        $texte.= '<input type="hidden" name="action" value="updateMask">';
75
+        $texte.= '<input type="hidden" name="maskconstdelivery" value="LIVRAISON_SAPHIR_MASK">';
76
+        $texte.= '<table class="nobordernopadding" width="100%">';
77 77
 
78
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
79
-		$tooltip.=$langs->trans("GenericMaskCodes2");
80
-		$tooltip.=$langs->trans("GenericMaskCodes3");
81
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
82
-		$tooltip.=$langs->trans("GenericMaskCodes5");
78
+        $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
79
+        $tooltip.=$langs->trans("GenericMaskCodes2");
80
+        $tooltip.=$langs->trans("GenericMaskCodes3");
81
+        $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
82
+        $tooltip.=$langs->trans("GenericMaskCodes5");
83 83
 
84
-		// Parametrage du prefix
85
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
86
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdelivery" value="'.$conf->global->LIVRAISON_SAPHIR_MASK.'">',$tooltip,1,1).'</td>';
84
+        // Parametrage du prefix
85
+        $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
86
+        $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdelivery" value="'.$conf->global->LIVRAISON_SAPHIR_MASK.'">',$tooltip,1,1).'</td>';
87 87
 
88
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
88
+        $texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
89 89
 
90
-		$texte.= '</tr>';
90
+        $texte.= '</tr>';
91 91
 
92
-		$texte.= '</table>';
93
-		$texte.= '</form>';
92
+        $texte.= '</table>';
93
+        $texte.= '</form>';
94 94
 
95
-		return $texte;
95
+        return $texte;
96 96
     }
97 97
 
98 98
     /**
@@ -102,54 +102,54 @@  discard block
 block discarded – undo
102 102
      */
103 103
     function getExample()
104 104
     {
105
-     	global $conf,$langs,$mysoc;
106
-
107
-    	$old_code_client=$mysoc->code_client;
108
-    	$mysoc->code_client='CCCCCCCCCC';
109
-		$numExample = $this->getNextValue($mysoc,'');
110
-    	$mysoc->code_client=$old_code_client;
111
-
112
-		if (! $numExample)
113
-		{
114
-			$numExample = $langs->trans('NotConfigured');
115
-		}
116
-		return $numExample;
105
+            global $conf,$langs,$mysoc;
106
+
107
+        $old_code_client=$mysoc->code_client;
108
+        $mysoc->code_client='CCCCCCCCCC';
109
+        $numExample = $this->getNextValue($mysoc,'');
110
+        $mysoc->code_client=$old_code_client;
111
+
112
+        if (! $numExample)
113
+        {
114
+            $numExample = $langs->trans('NotConfigured');
115
+        }
116
+        return $numExample;
117 117
     }
118 118
 
119 119
 
120
-	/**
121
-	 *  Return next value
122
-	 *
123
-	 *  @param	Societe		$objsoc     	Object third party
124
-	 *  @param  Object		$object			Object delivery
125
-	 *  @return string      				Value if OK, 0 if KO
126
-	 */
120
+    /**
121
+     *  Return next value
122
+     *
123
+     *  @param	Societe		$objsoc     	Object third party
124
+     *  @param  Object		$object			Object delivery
125
+     *  @return string      				Value if OK, 0 if KO
126
+     */
127 127
     function getNextValue($objsoc,$object)
128 128
     {
129
-		global $db,$conf;
129
+        global $db,$conf;
130 130
 
131
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
131
+        require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
132 132
 
133
-		// On defini critere recherche compteur
134
-		$mask=$conf->global->LIVRAISON_SAPHIR_MASK;
133
+        // On defini critere recherche compteur
134
+        $mask=$conf->global->LIVRAISON_SAPHIR_MASK;
135 135
 
136
-		if (! $mask)
137
-		{
138
-			$this->error='NotConfigured';
139
-			return 0;
140
-		}
136
+        if (! $mask)
137
+        {
138
+            $this->error='NotConfigured';
139
+            return 0;
140
+        }
141 141
 
142
-		$numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc,$object->date_livraison);
142
+        $numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc,$object->date_livraison);
143 143
 
144
-		return  $numFinal;
144
+        return  $numFinal;
145 145
     }
146 146
 
147 147
 
148
-	/**
149
-	 *  Return next free value
150
-	 *
148
+    /**
149
+     *  Return next free value
150
+     *
151 151
      *  @param	Societe		$objsoc     Object third party
152
-	 * 	@param	string		$objforref	Object for number to search
152
+     * 	@param	string		$objforref	Object for number to search
153 153
      *  @return string      			Next free value
154 154
      */
155 155
     function getNumRef($objsoc,$objforref)
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *	\ingroup    expedition
24 24
  *	\brief      Fichier contenant la classe du modele de numerotation de reference de livraison Saphir
25 25
  */
26
-require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/modules_livraison.php';
26
+require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php';
27 27
 
28 28
 /**
29 29
  *	\class      mod_livraison_saphir
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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 40
 	/**
41 41
 	 * @var string Error message
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 	 * @deprecated
48 48
 	 * @see name
49 49
 	 */
50
-	public $nom='Saphir';
50
+	public $nom = 'Saphir';
51 51
 
52 52
 	/**
53 53
 	 * @var string model name
54 54
 	 */
55
-	public $name='Saphir';
55
+	public $name = 'Saphir';
56 56
 
57 57
 
58 58
     /**
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
 		$form = new Form($this->db);
70 70
 
71 71
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
72
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
73
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
74
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
75
-		$texte.= '<input type="hidden" name="maskconstdelivery" value="LIVRAISON_SAPHIR_MASK">';
76
-		$texte.= '<table class="nobordernopadding" width="100%">';
77
-
78
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
79
-		$tooltip.=$langs->trans("GenericMaskCodes2");
80
-		$tooltip.=$langs->trans("GenericMaskCodes3");
81
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
82
-		$tooltip.=$langs->trans("GenericMaskCodes5");
72
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
73
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
74
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
75
+		$texte .= '<input type="hidden" name="maskconstdelivery" value="LIVRAISON_SAPHIR_MASK">';
76
+		$texte .= '<table class="nobordernopadding" width="100%">';
77
+
78
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Delivery"), $langs->transnoentities("Delivery"));
79
+		$tooltip .= $langs->trans("GenericMaskCodes2");
80
+		$tooltip .= $langs->trans("GenericMaskCodes3");
81
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Delivery"), $langs->transnoentities("Delivery"));
82
+		$tooltip .= $langs->trans("GenericMaskCodes5");
83 83
 
84 84
 		// Parametrage du prefix
85
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
86
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdelivery" value="'.$conf->global->LIVRAISON_SAPHIR_MASK.'">',$tooltip,1,1).'</td>';
85
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
86
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdelivery" value="'.$conf->global->LIVRAISON_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>';
87 87
 
88
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
88
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
89 89
 
90
-		$texte.= '</tr>';
90
+		$texte .= '</tr>';
91 91
 
92
-		$texte.= '</table>';
93
-		$texte.= '</form>';
92
+		$texte .= '</table>';
93
+		$texte .= '</form>';
94 94
 
95 95
 		return $texte;
96 96
     }
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
      */
103 103
     function getExample()
104 104
     {
105
-     	global $conf,$langs,$mysoc;
105
+     	global $conf, $langs, $mysoc;
106 106
 
107
-    	$old_code_client=$mysoc->code_client;
108
-    	$mysoc->code_client='CCCCCCCCCC';
109
-		$numExample = $this->getNextValue($mysoc,'');
110
-    	$mysoc->code_client=$old_code_client;
107
+    	$old_code_client = $mysoc->code_client;
108
+    	$mysoc->code_client = 'CCCCCCCCCC';
109
+		$numExample = $this->getNextValue($mysoc, '');
110
+    	$mysoc->code_client = $old_code_client;
111 111
 
112
-		if (! $numExample)
112
+		if (!$numExample)
113 113
 		{
114 114
 			$numExample = $langs->trans('NotConfigured');
115 115
 		}
@@ -124,22 +124,22 @@  discard block
 block discarded – undo
124 124
 	 *  @param  Object		$object			Object delivery
125 125
 	 *  @return string      				Value if OK, 0 if KO
126 126
 	 */
127
-    function getNextValue($objsoc,$object)
127
+    function getNextValue($objsoc, $object)
128 128
     {
129
-		global $db,$conf;
129
+		global $db, $conf;
130 130
 
131
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
131
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
132 132
 
133 133
 		// On defini critere recherche compteur
134
-		$mask=$conf->global->LIVRAISON_SAPHIR_MASK;
134
+		$mask = $conf->global->LIVRAISON_SAPHIR_MASK;
135 135
 
136
-		if (! $mask)
136
+		if (!$mask)
137 137
 		{
138
-			$this->error='NotConfigured';
138
+			$this->error = 'NotConfigured';
139 139
 			return 0;
140 140
 		}
141 141
 
142
-		$numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc,$object->date_livraison);
142
+		$numFinal = get_next_value($db, $mask, 'livraison', 'ref', '', $objsoc, $object->date_livraison);
143 143
 
144 144
 		return  $numFinal;
145 145
     }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 * 	@param	string		$objforref	Object for number to search
153 153
      *  @return string      			Next free value
154 154
      */
155
-    function getNumRef($objsoc,$objforref)
155
+    function getNumRef($objsoc, $objforref)
156 156
     {
157
-        return $this->getNextValue($objsoc,$objforref);
157
+        return $this->getNextValue($objsoc, $objforref);
158 158
     }
159 159
 
160 160
 
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
      *  @param  Object		$object			Objet livraison
167 167
      *  @return string      				Texte descripif
168 168
      */
169
-    function livraison_get_num($objsoc=0,$object='')
169
+    function livraison_get_num($objsoc = 0, $object = '')
170 170
     {
171 171
         // phpcs:enable
172
-        return $this->getNextValue($objsoc,$object);
172
+        return $this->getNextValue($objsoc, $object);
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modStripe.class.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         // Main menu entries
94 94
         $r=0;
95
-       /* $this->menu[$r]=array(
95
+        /* $this->menu[$r]=array(
96 96
         	'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment',		    // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
97 97
 	        'mainmenu'=>'billing',
98 98
         	'leftmenu'=>'customers_bills_payment_stripe',
@@ -109,47 +109,47 @@  discard block
 block discarded – undo
109 109
         $r++;*/
110 110
 
111 111
         $this->menu[$r] = array(
112
-        	'fk_menu'=>'fk_mainmenu=bank',
113
-			'type'=>'left',
114
-			'titre'=>'StripeAccount',
115
-			'mainmenu'=>'bank',
116
-			'leftmenu'=>'stripe',
117
-			'url' => '',
118
-			'langs' => 'stripe',
119
-			'position' => 100,
120
-			'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
121
-			'perms' => '$user->rights->banque->lire',
122
-			'target' => '',
123
-			'user' => 0
124
-		);
112
+            'fk_menu'=>'fk_mainmenu=bank',
113
+            'type'=>'left',
114
+            'titre'=>'StripeAccount',
115
+            'mainmenu'=>'bank',
116
+            'leftmenu'=>'stripe',
117
+            'url' => '',
118
+            'langs' => 'stripe',
119
+            'position' => 100,
120
+            'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
121
+            'perms' => '$user->rights->banque->lire',
122
+            'target' => '',
123
+            'user' => 0
124
+        );
125 125
 
126 126
         $r++;
127
-		$this->menu[$r] = array(
128
-			'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
129
-			'type' => 'left',
130
-			'titre' => 'StripeChargeList',
131
-			'url' => '/stripe/charge.php',
132
-			'langs' => 'stripe',
133
-			'position' => 102,
134
-			'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
135
-			'perms' => '$user->rights->banque->lire',
136
-			'target' => '',
137
-			'user' => 0
138
-		);
127
+        $this->menu[$r] = array(
128
+            'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
129
+            'type' => 'left',
130
+            'titre' => 'StripeChargeList',
131
+            'url' => '/stripe/charge.php',
132
+            'langs' => 'stripe',
133
+            'position' => 102,
134
+            'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
135
+            'perms' => '$user->rights->banque->lire',
136
+            'target' => '',
137
+            'user' => 0
138
+        );
139 139
 
140 140
         $r++;
141
-		$this->menu[$r] = array(
142
-			'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
143
-			'type' => 'left',
144
-			'titre' => 'StripeTransactionList',
145
-			'url' => '/stripe/transaction.php',
146
-			'langs' => 'stripe',
147
-			'position' => 102,
148
-			'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
149
-			'perms' => '$user->rights->banque->lire',
150
-			'target' => '',
151
-			'user' => 0
152
-		);
141
+        $this->menu[$r] = array(
142
+            'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
143
+            'type' => 'left',
144
+            'titre' => 'StripeTransactionList',
145
+            'url' => '/stripe/transaction.php',
146
+            'langs' => 'stripe',
147
+            'position' => 102,
148
+            'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
149
+            'perms' => '$user->rights->banque->lire',
150
+            'target' => '',
151
+            'user' => 0
152
+        );
153 153
 
154 154
         // Exports
155 155
         $r=1;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *  \ingroup    stripe
24 24
  *  \brief      Description and activation file for module Stripe
25 25
  */
26
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
26
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
27 27
 
28 28
 
29 29
 /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         // It is used to group modules in module setup page
51 51
         $this->family = "interface";
52 52
         // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
-        $this->name = preg_replace('/^mod/i','',get_class($this));
53
+        $this->name = preg_replace('/^mod/i', '', get_class($this));
54 54
         // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
55 55
         $this->description = "Module to offer an online payment page by credit card with Stripe";
56 56
         // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         // Name of image file used for this module.
61 61
         // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
62 62
         // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
63
-        $this->picto='stripe';
63
+        $this->picto = 'stripe';
64 64
 
65 65
         // Data directories to create when module is enabled.
66 66
         $this->dirs = array();
@@ -69,29 +69,29 @@  discard block
 block discarded – undo
69 69
         $this->config_page_url = array("stripe.php@stripe");
70 70
 
71 71
         // Dependencies
72
-        $this->hidden = false;			// A condition to hide module
73
-        $this->depends = array();		// List of modules id that must be enabled if this module is enabled
74
-        $this->requiredby = array();	// List of modules id to disable if this one is disabled
75
-        $this->phpmin = array(5,4);					// Minimum version of PHP required by module
76
-        $this->need_dolibarr_version = array(5,0);	// Minimum version of Dolibarr required by module
72
+        $this->hidden = false; // A condition to hide module
73
+        $this->depends = array(); // List of modules id that must be enabled if this module is enabled
74
+        $this->requiredby = array(); // List of modules id to disable if this one is disabled
75
+        $this->phpmin = array(5, 4); // Minimum version of PHP required by module
76
+        $this->need_dolibarr_version = array(5, 0); // Minimum version of Dolibarr required by module
77 77
         $this->langfiles = array("stripe");
78 78
 
79 79
         // Constants
80
-        $this->const = array();			// List of particular constants to add when module is enabled
80
+        $this->const = array(); // List of particular constants to add when module is enabled
81 81
 
82 82
         // New pages on tabs
83 83
         $this->tabs = array();
84 84
 
85 85
         // Boxes
86
-        $this->boxes = array();			// List of boxes
87
-        $r=0;
86
+        $this->boxes = array(); // List of boxes
87
+        $r = 0;
88 88
 
89 89
         // Permissions
90
-        $this->rights = array();		// Permission array used by this module
91
-        $r=0;
90
+        $this->rights = array(); // Permission array used by this module
91
+        $r = 0;
92 92
 
93 93
         // Main menu entries
94
-        $r=0;
94
+        $r = 0;
95 95
        /* $this->menu[$r]=array(
96 96
         	'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment',		    // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
97 97
 	        'mainmenu'=>'billing',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		);
153 153
 
154 154
         // Exports
155
-        $r=1;
155
+        $r = 1;
156 156
     }
157 157
 }
158 158
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modReceiptPrinter.class.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $this->name = preg_replace('/^mod/i','',get_class($this));
53 53
         // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
54 54
         $this->description = "ReceiptPrinterDesc";
55
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
55
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
56 56
         $this->version = 'development';
57 57
         $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
58 58
         // Name of image file used for this module.
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 
69 69
         // Dependencies
70 70
         $this->hidden = false;			// A condition to hide module
71
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
72
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
73
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
74
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
71
+        $this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
72
+        $this->requiredby = array();	// List of module ids to disable if this one is disabled
73
+        $this->conflictwith = array();	// List of module class names as string this module is in conflict with
74
+        $this->phpmin = array(5,4);		// Minimum version of PHP required by module
75 75
         $this->need_dolibarr_version = array(3,9,-2);   // Minimum version of Dolibarr required by module
76 76
         $this->conflictwith = array();
77 77
         $this->langfiles = array("receiptprinter");
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *  \ingroup    printing
26 26
  *  \brief      File of class to describe and activate module Receipt Printer
27 27
  */
28
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
28
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29 29
 
30 30
 
31 31
 
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
      */
43 43
     function __construct($db)
44 44
     {
45
-        $this->db = $db ;
45
+        $this->db = $db;
46 46
         $this->numero = 67000;
47 47
         // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
48 48
         // It is used to group modules in module setup page
49 49
         $this->family = "interface";
50 50
         $this->module_position = '53';
51 51
         // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
52
-        $this->name = preg_replace('/^mod/i','',get_class($this));
52
+        $this->name = preg_replace('/^mod/i', '', get_class($this));
53 53
         // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
54 54
         $this->description = "ReceiptPrinterDesc";
55 55
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
         $this->config_page_url = array("receiptprinter.php");
68 68
 
69 69
         // Dependencies
70
-        $this->hidden = false;			// A condition to hide module
71
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
72
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
73
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
74
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
75
-        $this->need_dolibarr_version = array(3,9,-2);   // Minimum version of Dolibarr required by module
70
+        $this->hidden = false; // A condition to hide module
71
+		$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
72
+		$this->requiredby = array(); // List of module ids to disable if this one is disabled
73
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with
74
+		$this->phpmin = array(5, 4); // Minimum version of PHP required by module
75
+        $this->need_dolibarr_version = array(3, 9, -2); // Minimum version of Dolibarr required by module
76 76
         $this->conflictwith = array();
77 77
         $this->langfiles = array("receiptprinter");
78 78
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->rights = array();
87 87
         $this->rights_class = 'receiptprinter';
88 88
 
89
-        $r=0;
89
+        $r = 0;
90 90
         // $this->rights[$r][0]     Id permission (unique tous modules confondus)
91 91
         // $this->rights[$r][1]     Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
92 92
         // $this->rights[$r][2]     Non utilise
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
         $this->rights[$r][4] = 'read';
103 103
 
104 104
         // Main menu entries
105
-        $this->menus = array();         // List of menus to add
106
-        $r=0;
105
+        $this->menus = array(); // List of menus to add
106
+        $r = 0;
107 107
 
108 108
         // This is to declare the Top Menu entry:
109 109
         //$this->menu[$r]=array(  'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',               // Put 0 if this is a top menu
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      *      @param      string  $options    Options when enabling module ('', 'noboxes')
131 131
      *      @return     int                 1 if OK, 0 if KO
132 132
      */
133
-    function init($options='')
133
+    function init($options = '')
134 134
     {
135 135
         global $conf;
136 136
         // Clean before activation
@@ -139,6 +139,6 @@  discard block
 block discarded – undo
139 139
             "CREATE TABLE IF NOT EXISTS llx_printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
140 140
             "CREATE TABLE IF NOT EXISTS llx_printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
141 141
             );
142
-        return $this->_init($sql,$options);
142
+        return $this->_init($sql, $options);
143 143
     }
144 144
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modComptabilite.class.php 2 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -35,89 +35,89 @@
 block discarded – undo
35 35
 class modComptabilite extends DolibarrModules
36 36
 {
37 37
 
38
-   /**
39
-	 *   Constructor. Define names, constants, directories, boxes, permissions
40
-	 *
41
-	 *   @param      DoliDB		$db      Database handler
42
-    */
43
-	function __construct($db)
44
-	{
45
-		global $conf;
46
-
47
-		$this->db = $db;
48
-		$this->numero = 10;
49
-
50
-		$this->family = "financial";
51
-		$this->module_position = '60';
52
-		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
-		$this->name = preg_replace('/^mod/i','',get_class($this));
54
-		$this->description = "Gestion sommaire de comptabilite";
55
-
56
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57
-		$this->version = 'dolibarr';
58
-
59
-		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
38
+    /**
39
+     *   Constructor. Define names, constants, directories, boxes, permissions
40
+     *
41
+     *   @param      DoliDB		$db      Database handler
42
+     */
43
+    function __construct($db)
44
+    {
45
+        global $conf;
46
+
47
+        $this->db = $db;
48
+        $this->numero = 10;
49
+
50
+        $this->family = "financial";
51
+        $this->module_position = '60';
52
+        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
+        $this->name = preg_replace('/^mod/i','',get_class($this));
54
+        $this->description = "Gestion sommaire de comptabilite";
55
+
56
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57
+        $this->version = 'dolibarr';
58
+
59
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60 60
         $this->picto='accounting';
61 61
 
62
-		// Config pages
63
-		$this->config_page_url = array("compta.php");
64
-
65
-		// Dependencies
66
-		$this->depends = array("modFacture","modBanque");
67
-		$this->requiredby = array();
68
-		$this->conflictwith = array("modAccounting");
69
-		$this->langfiles = array("compta");
70
-
71
-		// Constants
72
-		$this->const = array();
73
-
74
-		// Data directories to create when module is enabled
75
-		$this->dirs = array("/comptabilite/temp",
76
-		                    "/comptabilite/rapport",
77
-		                    "/comptabilite/export",
78
-		                    "/comptabilite/bordereau"
79
-		                    );
80
-
81
-		// Boxes
82
-		$this->boxes = array();
83
-
84
-		// Permissions
85
-		$this->rights = array();
86
-		$this->rights_class = 'compta';
87
-		$r=0;
88
-
89
-		$r++;
90
-		$this->rights[$r][0] = 95;
91
-		$this->rights[$r][1] = 'Lire CA, bilans, resultats';
92
-		$this->rights[$r][2] = 'r';
93
-		$this->rights[$r][3] = 0;
94
-		$this->rights[$r][4] = 'resultat';
95
-		$this->rights[$r][5] = 'lire';
96
-
97
-
98
-		// Menus
99
-		//-------
100
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
101
-	}
102
-
103
-
104
-   /**
105
-	 *		Function called when module is enabled.
106
-	 *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
107
-	 *		It also creates data directories
108
-	 *
62
+        // Config pages
63
+        $this->config_page_url = array("compta.php");
64
+
65
+        // Dependencies
66
+        $this->depends = array("modFacture","modBanque");
67
+        $this->requiredby = array();
68
+        $this->conflictwith = array("modAccounting");
69
+        $this->langfiles = array("compta");
70
+
71
+        // Constants
72
+        $this->const = array();
73
+
74
+        // Data directories to create when module is enabled
75
+        $this->dirs = array("/comptabilite/temp",
76
+                            "/comptabilite/rapport",
77
+                            "/comptabilite/export",
78
+                            "/comptabilite/bordereau"
79
+                            );
80
+
81
+        // Boxes
82
+        $this->boxes = array();
83
+
84
+        // Permissions
85
+        $this->rights = array();
86
+        $this->rights_class = 'compta';
87
+        $r=0;
88
+
89
+        $r++;
90
+        $this->rights[$r][0] = 95;
91
+        $this->rights[$r][1] = 'Lire CA, bilans, resultats';
92
+        $this->rights[$r][2] = 'r';
93
+        $this->rights[$r][3] = 0;
94
+        $this->rights[$r][4] = 'resultat';
95
+        $this->rights[$r][5] = 'lire';
96
+
97
+
98
+        // Menus
99
+        //-------
100
+        $this->menu = 1;        // This module add menu entries. They are coded into menu manager.
101
+    }
102
+
103
+
104
+    /**
105
+     *		Function called when module is enabled.
106
+     *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
107
+     *		It also creates data directories
108
+     *
109 109
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
110
-	 *      @return     int             	1 if OK, 0 if KO
111
-    */
112
-	function init($options='')
113
-	{
114
-		global $conf;
110
+     *      @return     int             	1 if OK, 0 if KO
111
+     */
112
+    function init($options='')
113
+    {
114
+        global $conf;
115 115
 
116
-		// Nettoyage avant activation
117
-		$this->remove($options);
116
+        // Nettoyage avant activation
117
+        $this->remove($options);
118 118
 
119
-		$sql = array();
119
+        $sql = array();
120 120
 
121
-		return $this->_init($sql,$options);
122
-	}
121
+        return $this->_init($sql,$options);
122
+    }
123 123
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * \brief      Fichier de description et activation du module Comptabilite
27 27
  */
28 28
 
29
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
29
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
30 30
 
31 31
 
32 32
 /**
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 		$this->family = "financial";
51 51
 		$this->module_position = '60';
52 52
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
-		$this->name = preg_replace('/^mod/i','',get_class($this));
53
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
54 54
 		$this->description = "Gestion sommaire de comptabilite";
55 55
 
56 56
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57 57
 		$this->version = 'dolibarr';
58 58
 
59 59
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60
-        $this->picto='accounting';
60
+        $this->picto = 'accounting';
61 61
 
62 62
 		// Config pages
63 63
 		$this->config_page_url = array("compta.php");
64 64
 
65 65
 		// Dependencies
66
-		$this->depends = array("modFacture","modBanque");
66
+		$this->depends = array("modFacture", "modBanque");
67 67
 		$this->requiredby = array();
68 68
 		$this->conflictwith = array("modAccounting");
69 69
 		$this->langfiles = array("compta");
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		// Permissions
85 85
 		$this->rights = array();
86 86
 		$this->rights_class = 'compta';
87
-		$r=0;
87
+		$r = 0;
88 88
 
89 89
 		$r++;
90 90
 		$this->rights[$r][0] = 95;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 		// Menus
99 99
 		//-------
100
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
100
+		$this->menu = 1; // This module add menu entries. They are coded into menu manager.
101 101
 	}
102 102
 
103 103
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
110 110
 	 *      @return     int             	1 if OK, 0 if KO
111 111
     */
112
-	function init($options='')
112
+	function init($options = '')
113 113
 	{
114 114
 		global $conf;
115 115
 
@@ -118,6 +118,6 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$sql = array();
120 120
 
121
-		return $this->_init($sql,$options);
121
+		return $this->_init($sql, $options);
122 122
 	}
123 123
 }
Please login to merge, or discard this patch.