@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | |
41 | 41 | $object = new stdClass(); |
42 | 42 | |
43 | - // Show more tabs from modules |
|
44 | - // Entries must be declared in modules descriptor with line |
|
45 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
46 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
43 | + // Show more tabs from modules |
|
44 | + // Entries must be declared in modules descriptor with line |
|
45 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
46 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
47 | 47 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'stripeadmin'); |
48 | 48 | |
49 | 49 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'stripeadmin', 'remove'); |
50 | 50 | |
51 | - return $head; |
|
51 | + return $head; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | global $conf, $langs; |
66 | 66 | |
67 | 67 | $langs->load("paypal"); |
68 | - $langs->load("paybox"); |
|
68 | + $langs->load("paybox"); |
|
69 | 69 | $langs->load("stripe"); |
70 | 70 | |
71 | - $servicename = 'Stripe'; |
|
72 | - $out = '<br><br>'; |
|
73 | - $out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>'; |
|
74 | - $url = getStripePaymentUrl(0, $type, $ref); |
|
75 | - $out .= '<input type="text" id="stripeurl" class="quatrevingtpercent" value="'.$url.'"><br>'; |
|
76 | - $out .= ajax_autoselect("stripeurl", 0); |
|
77 | - return $out; |
|
71 | + $servicename = 'Stripe'; |
|
72 | + $out = '<br><br>'; |
|
73 | + $out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>'; |
|
74 | + $url = getStripePaymentUrl(0, $type, $ref); |
|
75 | + $out .= '<input type="text" id="stripeurl" class="quatrevingtpercent" value="'.$url.'"><br>'; |
|
76 | + $out .= ajax_autoselect("stripeurl", 0); |
|
77 | + return $out; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -93,43 +93,43 @@ discard block |
||
93 | 93 | |
94 | 94 | $ref = str_replace(' ', '', $ref); |
95 | 95 | |
96 | - if ($type == 'free') |
|
97 | - { |
|
98 | - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : ''); |
|
99 | - } |
|
100 | - if ($type == 'order') |
|
101 | - { |
|
102 | - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : ''); |
|
103 | - if ($mode == 1) $out .= 'order_ref'; |
|
104 | - if ($mode == 0) $out .= urlencode($ref); |
|
105 | - $out .= ($mode ? '</font>' : ''); |
|
106 | - } |
|
107 | - if ($type == 'invoice') |
|
108 | - { |
|
109 | - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : ''); |
|
110 | - if ($mode == 1) $out .= 'invoice_ref'; |
|
111 | - if ($mode == 0) $out .= urlencode($ref); |
|
112 | - $out .= ($mode ? '</font>' : ''); |
|
113 | - } |
|
114 | - if ($type == 'contractline') |
|
115 | - { |
|
116 | - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : ''); |
|
117 | - if ($mode == 1) $out .= 'contractline_ref'; |
|
118 | - if ($mode == 0) $out .= urlencode($ref); |
|
119 | - $out .= ($mode ? '</font>' : ''); |
|
120 | - } |
|
121 | - if ($type == 'membersubscription') |
|
122 | - { |
|
123 | - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : ''); |
|
124 | - if ($mode == 1) $out .= 'member_ref'; |
|
125 | - if ($mode == 0) $out .= urlencode($ref); |
|
126 | - $out .= ($mode ? '</font>' : ''); |
|
127 | - } |
|
128 | - |
|
129 | - // For multicompany |
|
130 | - $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities |
|
131 | - |
|
132 | - return $out; |
|
96 | + if ($type == 'free') |
|
97 | + { |
|
98 | + $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : ''); |
|
99 | + } |
|
100 | + if ($type == 'order') |
|
101 | + { |
|
102 | + $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : ''); |
|
103 | + if ($mode == 1) $out .= 'order_ref'; |
|
104 | + if ($mode == 0) $out .= urlencode($ref); |
|
105 | + $out .= ($mode ? '</font>' : ''); |
|
106 | + } |
|
107 | + if ($type == 'invoice') |
|
108 | + { |
|
109 | + $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : ''); |
|
110 | + if ($mode == 1) $out .= 'invoice_ref'; |
|
111 | + if ($mode == 0) $out .= urlencode($ref); |
|
112 | + $out .= ($mode ? '</font>' : ''); |
|
113 | + } |
|
114 | + if ($type == 'contractline') |
|
115 | + { |
|
116 | + $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : ''); |
|
117 | + if ($mode == 1) $out .= 'contractline_ref'; |
|
118 | + if ($mode == 0) $out .= urlencode($ref); |
|
119 | + $out .= ($mode ? '</font>' : ''); |
|
120 | + } |
|
121 | + if ($type == 'membersubscription') |
|
122 | + { |
|
123 | + $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : ''); |
|
124 | + if ($mode == 1) $out .= 'member_ref'; |
|
125 | + if ($mode == 0) $out .= urlencode($ref); |
|
126 | + $out .= ($mode ? '</font>' : ''); |
|
127 | + } |
|
128 | + |
|
129 | + // For multicompany |
|
130 | + $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities |
|
131 | + |
|
132 | + return $out; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 |
@@ -100,29 +100,45 @@ discard block |
||
100 | 100 | if ($type == 'order') |
101 | 101 | { |
102 | 102 | $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : ''); |
103 | - if ($mode == 1) $out .= 'order_ref'; |
|
104 | - if ($mode == 0) $out .= urlencode($ref); |
|
103 | + if ($mode == 1) { |
|
104 | + $out .= 'order_ref'; |
|
105 | + } |
|
106 | + if ($mode == 0) { |
|
107 | + $out .= urlencode($ref); |
|
108 | + } |
|
105 | 109 | $out .= ($mode ? '</font>' : ''); |
106 | 110 | } |
107 | 111 | if ($type == 'invoice') |
108 | 112 | { |
109 | 113 | $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : ''); |
110 | - if ($mode == 1) $out .= 'invoice_ref'; |
|
111 | - if ($mode == 0) $out .= urlencode($ref); |
|
114 | + if ($mode == 1) { |
|
115 | + $out .= 'invoice_ref'; |
|
116 | + } |
|
117 | + if ($mode == 0) { |
|
118 | + $out .= urlencode($ref); |
|
119 | + } |
|
112 | 120 | $out .= ($mode ? '</font>' : ''); |
113 | 121 | } |
114 | 122 | if ($type == 'contractline') |
115 | 123 | { |
116 | 124 | $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : ''); |
117 | - if ($mode == 1) $out .= 'contractline_ref'; |
|
118 | - if ($mode == 0) $out .= urlencode($ref); |
|
125 | + if ($mode == 1) { |
|
126 | + $out .= 'contractline_ref'; |
|
127 | + } |
|
128 | + if ($mode == 0) { |
|
129 | + $out .= urlencode($ref); |
|
130 | + } |
|
119 | 131 | $out .= ($mode ? '</font>' : ''); |
120 | 132 | } |
121 | 133 | if ($type == 'membersubscription') |
122 | 134 | { |
123 | 135 | $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : ''); |
124 | - if ($mode == 1) $out .= 'member_ref'; |
|
125 | - if ($mode == 0) $out .= urlencode($ref); |
|
136 | + if ($mode == 1) { |
|
137 | + $out .= 'member_ref'; |
|
138 | + } |
|
139 | + if ($mode == 0) { |
|
140 | + $out .= urlencode($ref); |
|
141 | + } |
|
126 | 142 | $out .= ($mode ? '</font>' : ''); |
127 | 143 | } |
128 | 144 | |
@@ -159,14 +175,18 @@ discard block |
||
159 | 175 | if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) |
160 | 176 | { |
161 | 177 | $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code); |
162 | - if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
178 | + if (preg_match('/\((.*)\)/i', $field, $reg)) { |
|
179 | + $field = $reg[1]; |
|
180 | + } |
|
163 | 181 | $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1; |
164 | 182 | } |
165 | 183 | // Prof Id 2 |
166 | 184 | if ($fromcompany->idprof2) |
167 | 185 | { |
168 | 186 | $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code); |
169 | - if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
187 | + if (preg_match('/\((.*)\)/i', $field, $reg)) { |
|
188 | + $field = $reg[1]; |
|
189 | + } |
|
170 | 190 | $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2; |
171 | 191 | } |
172 | 192 | |
@@ -176,14 +196,18 @@ discard block |
||
176 | 196 | if ($fromcompany->idprof3) |
177 | 197 | { |
178 | 198 | $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code); |
179 | - if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
199 | + if (preg_match('/\((.*)\)/i', $field, $reg)) { |
|
200 | + $field = $reg[1]; |
|
201 | + } |
|
180 | 202 | $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3; |
181 | 203 | } |
182 | 204 | // Prof Id 4 |
183 | 205 | if ($fromcompany->idprof4) |
184 | 206 | { |
185 | 207 | $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code); |
186 | - if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
208 | + if (preg_match('/\((.*)\)/i', $field, $reg)) { |
|
209 | + $field = $reg[1]; |
|
210 | + } |
|
187 | 211 | $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4; |
188 | 212 | } |
189 | 213 | // IntraCommunautary VAT |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $objcanvas = null; |
82 | 82 | if (!empty($canvas)) |
83 | 83 | { |
84 | - require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; |
|
85 | - $objcanvas = new Canvas($db, $action); |
|
86 | - $objcanvas->getCanvas('thirdparty', 'card', $canvas); |
|
84 | + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; |
|
85 | + $objcanvas = new Canvas($db, $action); |
|
86 | + $objcanvas->getCanvas('thirdparty', 'card', $canvas); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // Security check |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | if (empty($reshook)) |
104 | 104 | { |
105 | 105 | if ($cancel) |
106 | - { |
|
107 | - $action = ''; |
|
108 | - if (!empty($backtopage)) |
|
109 | - { |
|
110 | - header("Location: ".$backtopage); |
|
111 | - exit; |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - // Selection of new fields |
|
116 | - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
106 | + { |
|
107 | + $action = ''; |
|
108 | + if (!empty($backtopage)) |
|
109 | + { |
|
110 | + header("Location: ".$backtopage); |
|
111 | + exit; |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + // Selection of new fields |
|
116 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | if ($socid > 0 && empty($object->id)) |
130 | 130 | { |
131 | - $result = $object->fetch($socid); |
|
131 | + $result = $object->fetch($socid); |
|
132 | 132 | if ($result <= 0) dol_print_error('', $object->error); |
133 | 133 | } |
134 | 134 |
@@ -42,12 +42,20 @@ discard block |
||
42 | 42 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
43 | 43 | require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
44 | 44 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
45 | -if (!empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
45 | +if (!empty($conf->adherent->enabled)) { |
|
46 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
47 | +} |
|
46 | 48 | |
47 | 49 | $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); |
48 | -if (!empty($conf->categorie->enabled)) $langs->load("categories"); |
|
49 | -if (!empty($conf->incoterm->enabled)) $langs->load("incoterm"); |
|
50 | -if (!empty($conf->notification->enabled)) $langs->load("mails"); |
|
50 | +if (!empty($conf->categorie->enabled)) { |
|
51 | + $langs->load("categories"); |
|
52 | +} |
|
53 | +if (!empty($conf->incoterm->enabled)) { |
|
54 | + $langs->load("incoterm"); |
|
55 | +} |
|
56 | +if (!empty($conf->notification->enabled)) { |
|
57 | + $langs->load("mails"); |
|
58 | +} |
|
51 | 59 | |
52 | 60 | $mesg = ''; $error = 0; $errors = array(); |
53 | 61 | |
@@ -56,8 +64,12 @@ discard block |
||
56 | 64 | $backtopage = GETPOST('backtopage', 'alpha'); |
57 | 65 | $confirm = GETPOST('confirm'); |
58 | 66 | $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); |
59 | -if ($user->socid) $socid = $user->socid; |
|
60 | -if (empty($socid) && $action == 'view') $action = 'create'; |
|
67 | +if ($user->socid) { |
|
68 | + $socid = $user->socid; |
|
69 | +} |
|
70 | +if (empty($socid) && $action == 'view') { |
|
71 | + $action = 'create'; |
|
72 | +} |
|
61 | 73 | |
62 | 74 | $object = new Societe($db); |
63 | 75 | $extrafields = new ExtraFields($db); |
@@ -87,7 +99,9 @@ discard block |
||
87 | 99 | |
88 | 100 | // Security check |
89 | 101 | $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); |
90 | -if (empty($user->rights->societe->contact->lire)) accessforbidden(); |
|
102 | +if (empty($user->rights->societe->contact->lire)) { |
|
103 | + accessforbidden(); |
|
104 | +} |
|
91 | 105 | |
92 | 106 | |
93 | 107 | /* |
@@ -96,7 +110,9 @@ discard block |
||
96 | 110 | |
97 | 111 | $parameters = array('id'=>$socid, 'objcanvas'=>$objcanvas); |
98 | 112 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
99 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
113 | +if ($reshook < 0) { |
|
114 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
115 | +} |
|
100 | 116 | |
101 | 117 | if (empty($reshook)) |
102 | 118 | { |
@@ -127,18 +143,24 @@ discard block |
||
127 | 143 | if ($socid > 0 && empty($object->id)) |
128 | 144 | { |
129 | 145 | $result = $object->fetch($socid); |
130 | - if ($result <= 0) dol_print_error('', $object->error); |
|
131 | -} |
|
146 | + if ($result <= 0) { |
|
147 | + dol_print_error('', $object->error); |
|
148 | + } |
|
149 | + } |
|
132 | 150 | |
133 | 151 | $title = $langs->trans("ThirdParty"); |
134 | -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$langs->trans('Card'); |
|
152 | +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
153 | + $title = $object->name." - ".$langs->trans('Card'); |
|
154 | +} |
|
135 | 155 | $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
136 | 156 | llxHeader('', $title, $help_url); |
137 | 157 | |
138 | 158 | $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; |
139 | 159 | |
140 | 160 | |
141 | -if (!empty($object->id)) $res = $object->fetch_optionals(); |
|
161 | +if (!empty($object->id)) { |
|
162 | + $res = $object->fetch_optionals(); |
|
163 | +} |
|
142 | 164 | //if ($res < 0) { dol_print_error($db); exit; } |
143 | 165 | |
144 | 166 |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | public $date_rum; |
42 | 42 | |
43 | 43 | /** |
44 | - * Date creation record (datec) |
|
45 | - * |
|
46 | - * @var integer |
|
47 | - */ |
|
48 | - public $datec; |
|
44 | + * Date creation record (datec) |
|
45 | + * |
|
46 | + * @var integer |
|
47 | + */ |
|
48 | + public $datec; |
|
49 | 49 | |
50 | 50 | /** |
51 | - * Date modification record (tms) |
|
52 | - * |
|
53 | - * @var integer |
|
54 | - */ |
|
55 | - public $datem; |
|
51 | + * Date modification record (tms) |
|
52 | + * |
|
53 | + * @var integer |
|
54 | + */ |
|
55 | + public $datem; |
|
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param int $notrigger 1=Disable triggers |
79 | 79 | * @return int <0 if KO, >= 0 if OK |
80 | 80 | */ |
81 | - public function create(User $user = null, $notrigger = 0) |
|
81 | + public function create(User $user = null, $notrigger = 0) |
|
82 | 82 | { |
83 | 83 | $now = dol_now(); |
84 | 84 | $error = 0; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $notrigger 1=Disable triggers |
138 | 138 | * @return int <=0 if KO, >0 if OK |
139 | 139 | */ |
140 | - public function update(User $user = null, $notrigger = 0) |
|
140 | + public function update(User $user = null, $notrigger = 0) |
|
141 | 141 | { |
142 | 142 | global $conf; |
143 | 143 | $error = 0; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param int $type If id of company filled, we say if we want record of this type only |
211 | 211 | * @return int <0 if KO, >0 if OK |
212 | 212 | */ |
213 | - public function fetch($id, $socid = 0, $default = 1, $type = 'ban') |
|
213 | + public function fetch($id, $socid = 0, $default = 1, $type = 'ban') |
|
214 | 214 | { |
215 | 215 | if (empty($id) && empty($socid)) return -1; |
216 | 216 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param int $notrigger 1=Disable triggers |
274 | 274 | * @return int <0 if KO, >0 if OK |
275 | 275 | */ |
276 | - public function delete(User $user = null, $notrigger = 0) |
|
276 | + public function delete(User $user = null, $notrigger = 0) |
|
277 | 277 | { |
278 | 278 | global $conf; |
279 | 279 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @param int $rib RIB id |
343 | 343 | * @return int 0 if KO, 1 if OK |
344 | 344 | */ |
345 | - public function setAsDefault($rib = 0) |
|
345 | + public function setAsDefault($rib = 0) |
|
346 | 346 | { |
347 | 347 | $sql1 = "SELECT rowid as id, fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; |
348 | 348 | $sql1 .= " WHERE rowid = ".($rib ? $rib : $this->id); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @return void |
400 | 400 | */ |
401 | - public function initAsSpecimen() |
|
401 | + public function initAsSpecimen() |
|
402 | 402 | { |
403 | 403 | $this->specimen = 1; |
404 | 404 | $this->ref = 'CBA'; |
@@ -88,8 +88,12 @@ discard block |
||
88 | 88 | if ($result) |
89 | 89 | { |
90 | 90 | $numrows = $this->db->num_rows($result); |
91 | - if ($this->default_rib && $numrows > 0) $this->default_rib = 0; |
|
92 | - if (empty($this->default_rib) && $numrows == 0) $this->default_rib = 1; |
|
91 | + if ($this->default_rib && $numrows > 0) { |
|
92 | + $this->default_rib = 0; |
|
93 | + } |
|
94 | + if (empty($this->default_rib) && $numrows == 0) { |
|
95 | + $this->default_rib = 1; |
|
96 | + } |
|
93 | 97 | } |
94 | 98 | |
95 | 99 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec)"; |
@@ -105,7 +109,9 @@ discard block |
||
105 | 109 | { |
106 | 110 | // Call trigger |
107 | 111 | $result = $this->call_trigger('COMPANY_RIB_CREATE', $user); |
108 | - if ($result < 0) $error++; |
|
112 | + if ($result < 0) { |
|
113 | + $error++; |
|
114 | + } |
|
109 | 115 | // End call triggers |
110 | 116 | |
111 | 117 | if (!$error) |
@@ -136,10 +142,16 @@ discard block |
||
136 | 142 | global $conf; |
137 | 143 | $error = 0; |
138 | 144 | |
139 | - if (!$this->id) return -1; |
|
145 | + if (!$this->id) { |
|
146 | + return -1; |
|
147 | + } |
|
140 | 148 | |
141 | - if (dol_strlen($this->domiciliation) > 255) $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1); |
|
142 | - if (dol_strlen($this->owner_address) > 255) $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1); |
|
149 | + if (dol_strlen($this->domiciliation) > 255) { |
|
150 | + $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1); |
|
151 | + } |
|
152 | + if (dol_strlen($this->owner_address) > 255) { |
|
153 | + $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1); |
|
154 | + } |
|
143 | 155 | |
144 | 156 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET"; |
145 | 157 | $sql .= " bank = '".$this->db->escape($this->bank)."'"; |
@@ -159,9 +171,11 @@ discard block |
||
159 | 171 | $sql .= ",rum = '".$this->db->escape($this->rum)."'"; |
160 | 172 | $sql .= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null"); |
161 | 173 | } |
162 | - if (trim($this->label) != '') |
|
163 | - $sql .= ",label = '".$this->db->escape($this->label)."'"; |
|
164 | - else $sql .= ",label = NULL"; |
|
174 | + if (trim($this->label) != '') { |
|
175 | + $sql .= ",label = '".$this->db->escape($this->label)."'"; |
|
176 | + } else { |
|
177 | + $sql .= ",label = NULL"; |
|
178 | + } |
|
165 | 179 | $sql .= " WHERE rowid = ".$this->id; |
166 | 180 | |
167 | 181 | $result = $this->db->query($sql); |
@@ -171,7 +185,9 @@ discard block |
||
171 | 185 | { |
172 | 186 | // Call trigger |
173 | 187 | $result = $this->call_trigger('COMPANY_RIB_MODIFY', $user); |
174 | - if ($result < 0) $error++; |
|
188 | + if ($result < 0) { |
|
189 | + $error++; |
|
190 | + } |
|
175 | 191 | // End call triggers |
176 | 192 | if (!$error) |
177 | 193 | { |
@@ -199,17 +215,25 @@ discard block |
||
199 | 215 | */ |
200 | 216 | public function fetch($id, $socid = 0, $default = 1, $type = 'ban') |
201 | 217 | { |
202 | - if (empty($id) && empty($socid)) return -1; |
|
218 | + if (empty($id) && empty($socid)) { |
|
219 | + return -1; |
|
220 | + } |
|
203 | 221 | |
204 | 222 | $sql = "SELECT rowid, type, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; |
205 | 223 | $sql .= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur, date_rum"; |
206 | 224 | $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib"; |
207 | - if ($id) $sql .= " WHERE rowid = ".$id; |
|
225 | + if ($id) { |
|
226 | + $sql .= " WHERE rowid = ".$id; |
|
227 | + } |
|
208 | 228 | if ($socid) |
209 | 229 | { |
210 | 230 | $sql .= " WHERE fk_soc = ".$socid; |
211 | - if ($default > -1) $sql .= " AND default_rib = ".$this->db->escape($default); |
|
212 | - if ($type) $sql .= " AND type ='".$this->db->escape($type)."'"; |
|
231 | + if ($default > -1) { |
|
232 | + $sql .= " AND default_rib = ".$this->db->escape($default); |
|
233 | + } |
|
234 | + if ($type) { |
|
235 | + $sql .= " AND type ='".$this->db->escape($type)."'"; |
|
236 | + } |
|
213 | 237 | } |
214 | 238 | |
215 | 239 | $resql = $this->db->query($sql); |
@@ -272,7 +296,9 @@ discard block |
||
272 | 296 | { |
273 | 297 | // Call trigger |
274 | 298 | $result = $this->call_trigger('COMPANY_RIB_DELETE', $user); |
275 | - if ($result < 0) $error++; |
|
299 | + if ($result < 0) { |
|
300 | + $error++; |
|
301 | + } |
|
276 | 302 | // End call triggers |
277 | 303 | } |
278 | 304 |
@@ -94,7 +94,9 @@ discard block |
||
94 | 94 | $module = 'fichinter'; |
95 | 95 | } |
96 | 96 | |
97 | - if (empty($conf->$module->enabled)) $enabled = false; |
|
97 | + if (empty($conf->$module->enabled)) { |
|
98 | + $enabled = false; |
|
99 | + } |
|
98 | 100 | |
99 | 101 | if ($enabled) { |
100 | 102 | /* |
@@ -189,8 +191,12 @@ discard block |
||
189 | 191 | print $langs->trans("ListOfAvailableAPIs").':<br>'; |
190 | 192 | foreach ($listofapis['v1'] as $key => $val) |
191 | 193 | { |
192 | - if ($key == 'login') continue; |
|
193 | - if ($key == 'index') continue; |
|
194 | + if ($key == 'login') { |
|
195 | + continue; |
|
196 | + } |
|
197 | + if ($key == 'index') { |
|
198 | + continue; |
|
199 | + } |
|
194 | 200 | |
195 | 201 | if ($key) |
196 | 202 | { |
@@ -198,7 +204,9 @@ discard block |
||
198 | 204 | { |
199 | 205 | $newclass = $val2['className']; |
200 | 206 | |
201 | - if (preg_match('/restler/i', $newclass)) continue; |
|
207 | + if (preg_match('/restler/i', $newclass)) { |
|
208 | + continue; |
|
209 | + } |
|
202 | 210 | |
203 | 211 | if ($oldclass != $newclass) |
204 | 212 | { |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | // Enable and test if module Api is enabled |
42 | 42 | if (empty($conf->global->MAIN_MODULE_API)) |
43 | 43 | { |
44 | - dol_syslog("Call Dolibarr API interfaces with module REST disabled"); |
|
45 | - print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>'; |
|
46 | - print $langs->trans("ToActivateModule"); |
|
47 | - exit; |
|
44 | + dol_syslog("Call Dolibarr API interfaces with module REST disabled"); |
|
45 | + print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>'; |
|
46 | + print $langs->trans("ToActivateModule"); |
|
47 | + exit; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -59,45 +59,45 @@ discard block |
||
59 | 59 | $modulesdir = dolGetModulesDirs(); |
60 | 60 | foreach ($modulesdir as $dir) |
61 | 61 | { |
62 | - /* |
|
62 | + /* |
|
63 | 63 | * Search available module |
64 | 64 | */ |
65 | - //dol_syslog("Scan directory ".$dir." for API modules"); |
|
66 | - |
|
67 | - $handle = @opendir(dol_osencode($dir)); |
|
68 | - if (is_resource($handle)) |
|
69 | - { |
|
70 | - while (($file = readdir($handle)) !== false) |
|
71 | - { |
|
72 | - if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg)) |
|
73 | - { |
|
74 | - $modulename = $reg[1]; |
|
75 | - |
|
76 | - // Defined if module is enabled |
|
77 | - $enabled = true; |
|
78 | - $module = $part = $obj = strtolower(preg_replace('/^mod/i', '', $modulename)); |
|
79 | - //if ($part == 'propale') $part='propal'; |
|
80 | - if ($module == 'societe') { |
|
65 | + //dol_syslog("Scan directory ".$dir." for API modules"); |
|
66 | + |
|
67 | + $handle = @opendir(dol_osencode($dir)); |
|
68 | + if (is_resource($handle)) |
|
69 | + { |
|
70 | + while (($file = readdir($handle)) !== false) |
|
71 | + { |
|
72 | + if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg)) |
|
73 | + { |
|
74 | + $modulename = $reg[1]; |
|
75 | + |
|
76 | + // Defined if module is enabled |
|
77 | + $enabled = true; |
|
78 | + $module = $part = $obj = strtolower(preg_replace('/^mod/i', '', $modulename)); |
|
79 | + //if ($part == 'propale') $part='propal'; |
|
80 | + if ($module == 'societe') { |
|
81 | 81 | $obj = 'thirdparty'; |
82 | 82 | } |
83 | - if ($module == 'categorie') { |
|
84 | - $part = 'categories'; |
|
83 | + if ($module == 'categorie') { |
|
84 | + $part = 'categories'; |
|
85 | 85 | $obj = 'category'; |
86 | 86 | } |
87 | - if ($module == 'facture') { |
|
88 | - $part = 'compta/facture'; |
|
87 | + if ($module == 'facture') { |
|
88 | + $part = 'compta/facture'; |
|
89 | 89 | $obj = 'facture'; |
90 | 90 | } |
91 | - if ($module == 'ficheinter') { |
|
92 | - $obj = 'fichinter'; |
|
93 | - $part = 'fichinter'; |
|
94 | - $module = 'fichinter'; |
|
95 | - } |
|
91 | + if ($module == 'ficheinter') { |
|
92 | + $obj = 'fichinter'; |
|
93 | + $part = 'fichinter'; |
|
94 | + $module = 'fichinter'; |
|
95 | + } |
|
96 | 96 | |
97 | - if (empty($conf->$module->enabled)) $enabled = false; |
|
97 | + if (empty($conf->$module->enabled)) $enabled = false; |
|
98 | 98 | |
99 | - if ($enabled) { |
|
100 | - /* |
|
99 | + if ($enabled) { |
|
100 | + /* |
|
101 | 101 | * If exists, load the API class for enable module |
102 | 102 | * |
103 | 103 | * Search files named api_<object>.class.php into /htdocs/<module>/class directory |
@@ -105,25 +105,25 @@ discard block |
||
105 | 105 | * @todo : take care of externals module! |
106 | 106 | * @todo : use getElementProperties() function ? |
107 | 107 | */ |
108 | - $dir_part = DOL_DOCUMENT_ROOT.'/'.$part.'/class/'; |
|
109 | - |
|
110 | - $handle_part = @opendir(dol_osencode($dir_part)); |
|
111 | - if (is_resource($handle_part)) |
|
112 | - { |
|
113 | - while (($file_searched = readdir($handle_part)) !== false) |
|
114 | - { |
|
115 | - if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $reg)) |
|
116 | - { |
|
117 | - $classname = ucwords($reg[1]); |
|
118 | - require_once $dir_part.$file_searched; |
|
119 | - if (class_exists($classname)) |
|
120 | - { |
|
121 | - dol_syslog("Found API classname=".$classname." into ".$dir); |
|
122 | - $listofapis[] = $classname; |
|
123 | - } |
|
124 | - } |
|
125 | - |
|
126 | - /* |
|
108 | + $dir_part = DOL_DOCUMENT_ROOT.'/'.$part.'/class/'; |
|
109 | + |
|
110 | + $handle_part = @opendir(dol_osencode($dir_part)); |
|
111 | + if (is_resource($handle_part)) |
|
112 | + { |
|
113 | + while (($file_searched = readdir($handle_part)) !== false) |
|
114 | + { |
|
115 | + if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $reg)) |
|
116 | + { |
|
117 | + $classname = ucwords($reg[1]); |
|
118 | + require_once $dir_part.$file_searched; |
|
119 | + if (class_exists($classname)) |
|
120 | + { |
|
121 | + dol_syslog("Found API classname=".$classname." into ".$dir); |
|
122 | + $listofapis[] = $classname; |
|
123 | + } |
|
124 | + } |
|
125 | + |
|
126 | + /* |
|
127 | 127 | if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg)) |
128 | 128 | { |
129 | 129 | $classname=$reg[1]; |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | // //$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched); |
149 | 149 | // } |
150 | 150 | }*/ |
151 | - } |
|
152 | - } |
|
153 | - } |
|
154 | - } |
|
155 | - } |
|
156 | - } |
|
151 | + } |
|
152 | + } |
|
153 | + } |
|
154 | + } |
|
155 | + } |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | //var_dump($listofapis); |
@@ -186,28 +186,28 @@ discard block |
||
186 | 186 | print $langs->trans("ListOfAvailableAPIs").':<br>'; |
187 | 187 | foreach ($listofapis['v1'] as $key => $val) |
188 | 188 | { |
189 | - if ($key == 'login') continue; |
|
190 | - if ($key == 'index') continue; |
|
191 | - |
|
192 | - if ($key) |
|
193 | - { |
|
194 | - foreach ($val as $method => $val2) |
|
195 | - { |
|
196 | - $newclass = $val2['className']; |
|
197 | - |
|
198 | - if (preg_match('/restler/i', $newclass)) continue; |
|
199 | - |
|
200 | - if ($oldclass != $newclass) |
|
201 | - { |
|
202 | - print "\n<br>\n".$langs->trans("Class").': '.$newclass.'<br>'."\n"; |
|
203 | - $oldclass = $newclass; |
|
204 | - } |
|
205 | - //print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n"; |
|
206 | - $url = $urlwithroot.'/api/index.php/'.$key; |
|
207 | - $url .= '?api_key=token'; |
|
208 | - print img_picto('', 'globe').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n"; |
|
209 | - } |
|
210 | - } |
|
189 | + if ($key == 'login') continue; |
|
190 | + if ($key == 'index') continue; |
|
191 | + |
|
192 | + if ($key) |
|
193 | + { |
|
194 | + foreach ($val as $method => $val2) |
|
195 | + { |
|
196 | + $newclass = $val2['className']; |
|
197 | + |
|
198 | + if (preg_match('/restler/i', $newclass)) continue; |
|
199 | + |
|
200 | + if ($oldclass != $newclass) |
|
201 | + { |
|
202 | + print "\n<br>\n".$langs->trans("Class").': '.$newclass.'<br>'."\n"; |
|
203 | + $oldclass = $newclass; |
|
204 | + } |
|
205 | + //print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n"; |
|
206 | + $url = $urlwithroot.'/api/index.php/'.$key; |
|
207 | + $url .= '?api_key=token'; |
|
208 | + print img_picto('', 'globe').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n"; |
|
209 | + } |
|
210 | + } |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | print '<br>'; |
@@ -726,8 +726,8 @@ |
||
726 | 726 | } |
727 | 727 | |
728 | 728 | $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); |
729 | - $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); |
|
730 | - $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
729 | + $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); |
|
730 | + $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
731 | 731 | |
732 | 732 | $varlink = 'id_journal='.$id_journal; |
733 | 733 |
@@ -51,13 +51,16 @@ discard block |
||
51 | 51 | $date_endday = GETPOST('date_endday'); |
52 | 52 | $date_endyear = GETPOST('date_endyear'); |
53 | 53 | $in_bookkeeping = GETPOST('in_bookkeeping'); |
54 | -if ($in_bookkeeping == '') $in_bookkeeping = 'notyet'; |
|
54 | +if ($in_bookkeeping == '') { |
|
55 | + $in_bookkeeping = 'notyet'; |
|
56 | +} |
|
55 | 57 | |
56 | 58 | $now = dol_now(); |
57 | 59 | |
58 | 60 | // Security check |
59 | -if ($user->socid > 0) |
|
61 | +if ($user->socid > 0) { |
|
60 | 62 | accessforbidden(); |
63 | +} |
|
61 | 64 | |
62 | 65 | $hookmanager->initHooks(array('purchasesjournal')); |
63 | 66 | $parameters = array(); |
@@ -88,9 +91,11 @@ discard block |
||
88 | 91 | $pastmonth = $dates['pastmonth']; |
89 | 92 | } |
90 | 93 | |
91 | -if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form |
|
94 | +if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { |
|
95 | + // We define date_start and date_end, only if we did not submit the form |
|
92 | 96 | { |
93 | 97 | $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); |
98 | +} |
|
94 | 99 | $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); |
95 | 100 | } |
96 | 101 | |
@@ -111,8 +116,9 @@ discard block |
||
111 | 116 | } else { |
112 | 117 | $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; |
113 | 118 | } |
114 | -if ($date_start && $date_end) |
|
119 | +if ($date_start && $date_end) { |
|
115 | 120 | $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; |
121 | +} |
|
116 | 122 | // Define begin binding date |
117 | 123 | if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { |
118 | 124 | $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; |
@@ -156,9 +162,9 @@ discard block |
||
156 | 162 | |
157 | 163 | $compta_prod = $obj->compte; |
158 | 164 | if (empty($compta_prod)) { |
159 | - if ($obj->product_type == 0) |
|
160 | - $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined'; |
|
161 | - else { |
|
165 | + if ($obj->product_type == 0) { |
|
166 | + $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined'; |
|
167 | + } else { |
|
162 | 168 | $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined'; |
163 | 169 | } |
164 | 170 | } |
@@ -189,19 +195,31 @@ discard block |
||
189 | 195 | //$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid; |
190 | 196 | |
191 | 197 | // Avoid warnings |
192 | - if (!isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0; |
|
193 | - if (!isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0; |
|
194 | - if (!isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0; |
|
195 | - if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0; |
|
196 | - if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; |
|
198 | + if (!isset($tabttc[$obj->rowid][$compta_soc])) { |
|
199 | + $tabttc[$obj->rowid][$compta_soc] = 0; |
|
200 | + } |
|
201 | + if (!isset($tabht[$obj->rowid][$compta_prod])) { |
|
202 | + $tabht[$obj->rowid][$compta_prod] = 0; |
|
203 | + } |
|
204 | + if (!isset($tabtva[$obj->rowid][$compta_tva])) { |
|
205 | + $tabtva[$obj->rowid][$compta_tva] = 0; |
|
206 | + } |
|
207 | + if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) { |
|
208 | + $tablocaltax1[$obj->rowid][$compta_localtax1] = 0; |
|
209 | + } |
|
210 | + if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) { |
|
211 | + $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; |
|
212 | + } |
|
197 | 213 | |
198 | 214 | $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; |
199 | 215 | $tabht[$obj->rowid][$compta_prod] += $obj->total_ht; |
200 | 216 | $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; |
201 | - if (!empty($line->tva_npr)) // Add an entry for counterpart |
|
217 | + if (!empty($line->tva_npr)) { |
|
218 | + // Add an entry for counterpart |
|
202 | 219 | { |
203 | 220 | $tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva; |
204 | 221 | } |
222 | + } |
|
205 | 223 | $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1; |
206 | 224 | $tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2; |
207 | 225 | $tabcompany[$obj->rowid] = array( |
@@ -233,8 +251,10 @@ discard block |
||
233 | 251 | { |
234 | 252 | $errorforinvoice[$key] = 'somelinesarenotbound'; |
235 | 253 | } |
236 | - } else dol_print_error($db); |
|
237 | -} |
|
254 | + } else { |
|
255 | + dol_print_error($db); |
|
256 | + } |
|
257 | + } |
|
238 | 258 | //var_dump($errorforinvoice);exit; |
239 | 259 | |
240 | 260 | |
@@ -278,7 +298,9 @@ discard block |
||
278 | 298 | { |
279 | 299 | $replacedinvoice = 1; |
280 | 300 | $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. |
281 | - if ($alreadydispatched) $replacedinvoice = 2; |
|
301 | + if ($alreadydispatched) { |
|
302 | + $replacedinvoice = 2; |
|
303 | + } |
|
282 | 304 | } |
283 | 305 | |
284 | 306 | // If not already into bookkeeping, we won't add it. If yes, do nothing (should not happen because creating replacement not possible if invoice is accounted) |
@@ -331,9 +353,11 @@ discard block |
||
331 | 353 | |
332 | 354 | $result = $bookkeeping->create($user); |
333 | 355 | if ($result < 0) { |
334 | - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists |
|
356 | + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { |
|
357 | + // Already exists |
|
335 | 358 | { |
336 | 359 | $error++; |
360 | + } |
|
337 | 361 | $errorforline++; |
338 | 362 | $errorforinvoice[$key] = 'alreadyjournalized'; |
339 | 363 | //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); |
@@ -381,9 +405,11 @@ discard block |
||
381 | 405 | |
382 | 406 | $result = $bookkeeping->create($user); |
383 | 407 | if ($result < 0) { |
384 | - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists |
|
408 | + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { |
|
409 | + // Already exists |
|
385 | 410 | { |
386 | 411 | $error++; |
412 | + } |
|
387 | 413 | $errorforline++; |
388 | 414 | $errorforinvoice[$key] = 'alreadyjournalized'; |
389 | 415 | //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); |
@@ -406,8 +432,12 @@ discard block |
||
406 | 432 | foreach ($listoftax as $numtax) |
407 | 433 | { |
408 | 434 | $arrayofvat = $tabtva; |
409 | - if ($numtax == 1) $arrayofvat = $tablocaltax1; |
|
410 | - if ($numtax == 2) $arrayofvat = $tablocaltax2; |
|
435 | + if ($numtax == 1) { |
|
436 | + $arrayofvat = $tablocaltax1; |
|
437 | + } |
|
438 | + if ($numtax == 2) { |
|
439 | + $arrayofvat = $tablocaltax2; |
|
440 | + } |
|
411 | 441 | |
412 | 442 | foreach ($arrayofvat[$key] as $k => $mt) { |
413 | 443 | if ($mt) { |
@@ -442,9 +472,11 @@ discard block |
||
442 | 472 | |
443 | 473 | $result = $bookkeeping->create($user); |
444 | 474 | if ($result < 0) { |
445 | - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists |
|
475 | + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { |
|
476 | + // Already exists |
|
446 | 477 | { |
447 | 478 | $error++; |
479 | + } |
|
448 | 480 | $errorforline++; |
449 | 481 | $errorforinvoice[$key] = 'alreadyjournalized'; |
450 | 482 | //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); |
@@ -493,9 +525,11 @@ discard block |
||
493 | 525 | |
494 | 526 | $result = $bookkeeping->create($user); |
495 | 527 | if ($result < 0) { |
496 | - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists |
|
528 | + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { |
|
529 | + // Already exists |
|
497 | 530 | { |
498 | 531 | $error++; |
532 | + } |
|
499 | 533 | $errorforline++; |
500 | 534 | $errorforinvoice[$key] = 'alreadyjournalized'; |
501 | 535 | //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); |
@@ -604,7 +638,9 @@ discard block |
||
604 | 638 | { |
605 | 639 | $replacedinvoice = 1; |
606 | 640 | $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. |
607 | - if ($alreadydispatched) $replacedinvoice = 2; |
|
641 | + if ($alreadydispatched) { |
|
642 | + $replacedinvoice = 2; |
|
643 | + } |
|
608 | 644 | } |
609 | 645 | |
610 | 646 | // If not already into bookkeeping, we won't add it. If yes, do nothing (should not happen because creating replacement not possible if invoice is accounted) |
@@ -657,8 +693,12 @@ discard block |
||
657 | 693 | $listoftax = array(0, 1, 2); |
658 | 694 | foreach ($listoftax as $numtax) { |
659 | 695 | $arrayofvat = $tabtva; |
660 | - if ($numtax == 1) $arrayofvat = $tablocaltax1; |
|
661 | - if ($numtax == 2) $arrayofvat = $tablocaltax2; |
|
696 | + if ($numtax == 1) { |
|
697 | + $arrayofvat = $tablocaltax1; |
|
698 | + } |
|
699 | + if ($numtax == 2) { |
|
700 | + $arrayofvat = $tablocaltax2; |
|
701 | + } |
|
662 | 702 | |
663 | 703 | foreach ($arrayofvat[$key] as $k => $mt) { |
664 | 704 | if ($mt) { |
@@ -733,12 +773,17 @@ discard block |
||
733 | 773 | print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); |
734 | 774 | } |
735 | 775 | print '<div class="tabsAction tabsActionNoBottom">'; |
736 | - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; |
|
776 | + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { |
|
777 | + print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; |
|
778 | + } |
|
737 | 779 | if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { |
738 | 780 | print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; |
739 | 781 | } else { |
740 | - if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />'; |
|
741 | - else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>'; |
|
782 | + if ($in_bookkeeping == 'notyet') { |
|
783 | + print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />'; |
|
784 | + } else { |
|
785 | + print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>'; |
|
786 | + } |
|
742 | 787 | } |
743 | 788 | print '</div>'; |
744 | 789 | |
@@ -806,7 +851,9 @@ discard block |
||
806 | 851 | { |
807 | 852 | $replacedinvoice = 1; |
808 | 853 | $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. |
809 | - if ($alreadydispatched) $replacedinvoice = 2; |
|
854 | + if ($alreadydispatched) { |
|
855 | + $replacedinvoice = 2; |
|
856 | + } |
|
810 | 857 | } |
811 | 858 | |
812 | 859 | // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???. |
@@ -863,7 +910,9 @@ discard block |
||
863 | 910 | if (($accountoshow == "") || $accountoshow == 'NotDefined') |
864 | 911 | { |
865 | 912 | print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>'; |
866 | - } else print $accountoshow; |
|
913 | + } else { |
|
914 | + print $accountoshow; |
|
915 | + } |
|
867 | 916 | print '</td>'; |
868 | 917 | // Subledger account |
869 | 918 | print "<td>"; |
@@ -871,7 +920,9 @@ discard block |
||
871 | 920 | if (($accountoshow == "") || $accountoshow == 'NotDefined') |
872 | 921 | { |
873 | 922 | print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>'; |
874 | - } else print $accountoshow; |
|
923 | + } else { |
|
924 | + print $accountoshow; |
|
925 | + } |
|
875 | 926 | print '</td>'; |
876 | 927 | print "<td>".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount")."</td>"; |
877 | 928 | print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>"; |
@@ -894,7 +945,9 @@ discard block |
||
894 | 945 | if (($accountoshow == "") || $accountoshow == 'NotDefined') |
895 | 946 | { |
896 | 947 | print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>'; |
897 | - } else print $accountoshow; |
|
948 | + } else { |
|
949 | + print $accountoshow; |
|
950 | + } |
|
898 | 951 | print "</td>"; |
899 | 952 | // Subledger account |
900 | 953 | print "<td>"; |
@@ -911,8 +964,12 @@ discard block |
||
911 | 964 | $listoftax = array(0, 1, 2); |
912 | 965 | foreach ($listoftax as $numtax) { |
913 | 966 | $arrayofvat = $tabtva; |
914 | - if ($numtax == 1) $arrayofvat = $tablocaltax1; |
|
915 | - if ($numtax == 2) $arrayofvat = $tablocaltax2; |
|
967 | + if ($numtax == 1) { |
|
968 | + $arrayofvat = $tablocaltax1; |
|
969 | + } |
|
970 | + if ($numtax == 2) { |
|
971 | + $arrayofvat = $tablocaltax2; |
|
972 | + } |
|
916 | 973 | |
917 | 974 | foreach ($arrayofvat[$key] as $k => $mt) { |
918 | 975 | if ($mt) { |
@@ -926,7 +983,9 @@ discard block |
||
926 | 983 | if (($accountoshow == "") || $accountoshow == 'NotDefined') |
927 | 984 | { |
928 | 985 | print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')</span>'; |
929 | - } else print $accountoshow; |
|
986 | + } else { |
|
987 | + print $accountoshow; |
|
988 | + } |
|
930 | 989 | print "</td>"; |
931 | 990 | // Subledger account |
932 | 991 | print "<td>"; |
@@ -956,7 +1015,9 @@ discard block |
||
956 | 1015 | if ($accountoshow == '' || $accountoshow == 'NotDefined') |
957 | 1016 | { |
958 | 1017 | print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account</span>'; |
959 | - } else print $accountoshow; |
|
1018 | + } else { |
|
1019 | + print $accountoshow; |
|
1020 | + } |
|
960 | 1021 | print '</td>'; |
961 | 1022 | // Subledger account |
962 | 1023 | print "<td>"; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | // Parameters ACCOUNTING_EXPORT_* |
47 | 47 | $main_option = array( |
48 | - 'ACCOUNTING_EXPORT_PREFIX_SPEC', |
|
48 | + 'ACCOUNTING_EXPORT_PREFIX_SPEC', |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | $configuration = AccountancyExport::getTypeConfig(); |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | $model_option = array( |
61 | - '1' => array( |
|
62 | - 'label' => 'ACCOUNTING_EXPORT_FORMAT', |
|
63 | - 'param' => $listformat, |
|
64 | - ), |
|
65 | - '2' => array( |
|
66 | - 'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV', |
|
67 | - 'param' => '', |
|
68 | - ), |
|
69 | - '3' => array( |
|
70 | - 'label' => 'ACCOUNTING_EXPORT_ENDLINE', |
|
71 | - 'param' => $listcr, |
|
72 | - ), |
|
73 | - '4' => array( |
|
74 | - 'label' => 'ACCOUNTING_EXPORT_DATE', |
|
75 | - 'param' => '', |
|
76 | - ), |
|
61 | + '1' => array( |
|
62 | + 'label' => 'ACCOUNTING_EXPORT_FORMAT', |
|
63 | + 'param' => $listformat, |
|
64 | + ), |
|
65 | + '2' => array( |
|
66 | + 'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV', |
|
67 | + 'param' => '', |
|
68 | + ), |
|
69 | + '3' => array( |
|
70 | + 'label' => 'ACCOUNTING_EXPORT_ENDLINE', |
|
71 | + 'param' => $listcr, |
|
72 | + ), |
|
73 | + '4' => array( |
|
74 | + 'label' => 'ACCOUNTING_EXPORT_DATE', |
|
75 | + 'param' => '', |
|
76 | + ), |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | |
@@ -105,22 +105,22 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - foreach ($listparam[$modelcsv] as $key => $value) { |
|
109 | - $constante = $key; |
|
108 | + foreach ($listparam[$modelcsv] as $key => $value) { |
|
109 | + $constante = $key; |
|
110 | 110 | |
111 | - if (strpos($constante, 'ACCOUNTING') !== false) { |
|
112 | - $constvalue = GETPOST($key, 'alpha'); |
|
113 | - if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) { |
|
114 | - $error++; |
|
115 | - } |
|
116 | - } |
|
117 | - } |
|
111 | + if (strpos($constante, 'ACCOUNTING') !== false) { |
|
112 | + $constvalue = GETPOST($key, 'alpha'); |
|
113 | + if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) { |
|
114 | + $error++; |
|
115 | + } |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | if (!$error) { |
120 | - // reload |
|
121 | - $configuration = AccountancyExport::getTypeConfig(); |
|
122 | - $listparam = $configuration['param']; |
|
123 | - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
|
120 | + // reload |
|
121 | + $configuration = AccountancyExport::getTypeConfig(); |
|
122 | + $listparam = $configuration['param']; |
|
123 | + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
|
124 | 124 | } else { |
125 | 125 | setEventMessages($langs->trans("Error"), null, 'errors'); |
126 | 126 | } |
@@ -148,36 +148,36 @@ discard block |
||
148 | 148 | print ' function initfields()'."\n"; |
149 | 149 | print ' {'."\n"; |
150 | 150 | foreach ($listparam as $key => $param) { |
151 | - print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n"; |
|
152 | - print ' {'."\n"; |
|
153 | - print ' //console.log("'.$param['label'].'");'."\n"; |
|
154 | - if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) { |
|
155 | - print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n"; |
|
156 | - print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n"; |
|
157 | - } else { |
|
158 | - print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n"; |
|
159 | - print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n"; |
|
160 | - } |
|
161 | - if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) { |
|
162 | - print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n"; |
|
163 | - print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n"; |
|
164 | - } else { |
|
165 | - print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n"; |
|
166 | - print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n"; |
|
167 | - } |
|
168 | - if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) { |
|
169 | - print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n"; |
|
170 | - } else { |
|
171 | - print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n"; |
|
172 | - } |
|
173 | - if (empty($param['ACCOUNTING_EXPORT_DATE'])) { |
|
174 | - print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n"; |
|
175 | - print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n"; |
|
176 | - } else { |
|
177 | - print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n"; |
|
178 | - print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n"; |
|
179 | - } |
|
180 | - print ' }'."\n"; |
|
151 | + print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n"; |
|
152 | + print ' {'."\n"; |
|
153 | + print ' //console.log("'.$param['label'].'");'."\n"; |
|
154 | + if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) { |
|
155 | + print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n"; |
|
156 | + print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n"; |
|
157 | + } else { |
|
158 | + print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n"; |
|
159 | + print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n"; |
|
160 | + } |
|
161 | + if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) { |
|
162 | + print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n"; |
|
163 | + print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n"; |
|
164 | + } else { |
|
165 | + print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n"; |
|
166 | + print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n"; |
|
167 | + } |
|
168 | + if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) { |
|
169 | + print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n"; |
|
170 | + } else { |
|
171 | + print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n"; |
|
172 | + } |
|
173 | + if (empty($param['ACCOUNTING_EXPORT_DATE'])) { |
|
174 | + print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n"; |
|
175 | + print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n"; |
|
176 | + } else { |
|
177 | + print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n"; |
|
178 | + print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n"; |
|
179 | + } |
|
180 | + print ' }'."\n"; |
|
181 | 181 | } |
182 | 182 | print ' }'."\n"; |
183 | 183 | print ' initfields();'."\n"; |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | foreach ($model_option as $key) { |
263 | 263 | print '<tr class="oddeven value">'; |
264 | 264 | |
265 | - // Param |
|
266 | - $label = $key['label']; |
|
265 | + // Param |
|
266 | + $label = $key['label']; |
|
267 | 267 | print '<td width="50%">'.$langs->trans($label).'</td>'; |
268 | 268 | |
269 | 269 | // Value |
270 | - print '<td>'; |
|
271 | - if (is_array($key['param'])) { |
|
272 | - print $form->selectarray($label, $key['param'], $conf->global->$label, 0); |
|
273 | - } else { |
|
274 | - print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.$conf->global->$label.'">'; |
|
275 | - } |
|
270 | + print '<td>'; |
|
271 | + if (is_array($key['param'])) { |
|
272 | + print $form->selectarray($label, $key['param'], $conf->global->$label, 0); |
|
273 | + } else { |
|
274 | + print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.$conf->global->$label.'">'; |
|
275 | + } |
|
276 | 276 | |
277 | 277 | print '</td></tr>'; |
278 | 278 | } |
@@ -112,7 +112,7 @@ |
||
112 | 112 | $i = 0; |
113 | 113 | |
114 | 114 | |
115 | - $addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write); |
|
115 | + $addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write); |
|
116 | 116 | |
117 | 117 | |
118 | 118 | $title = $langs->trans('AccountingPeriods'); |
@@ -36,17 +36,25 @@ discard block |
||
36 | 36 | $offset = $limit * $page; |
37 | 37 | $pageprev = $page - 1; |
38 | 38 | $pagenext = $page + 1; |
39 | -if (!$sortfield) $sortfield = "f.rowid"; // Set here default search field |
|
40 | -if (!$sortorder) $sortorder = "ASC"; |
|
39 | +if (!$sortfield) { |
|
40 | + $sortfield = "f.rowid"; |
|
41 | +} |
|
42 | +// Set here default search field |
|
43 | +if (!$sortorder) { |
|
44 | + $sortorder = "ASC"; |
|
45 | +} |
|
41 | 46 | |
42 | 47 | // Load translation files required by the page |
43 | 48 | $langs->loadLangs(array("admin", "compta")); |
44 | 49 | |
45 | 50 | // Security check |
46 | -if ($user->socid > 0) |
|
51 | +if ($user->socid > 0) { |
|
47 | 52 | accessforbidden(); |
48 | -if (!$user->rights->accounting->fiscalyear->write) // If we can read accounting records, we should be able to see fiscal year. |
|
53 | +} |
|
54 | +if (!$user->rights->accounting->fiscalyear->write) { |
|
55 | + // If we can read accounting records, we should be able to see fiscal year. |
|
49 | 56 | accessforbidden(); |
57 | +} |
|
50 | 58 | |
51 | 59 | $error = 0; |
52 | 60 | |
@@ -58,8 +66,9 @@ discard block |
||
58 | 66 | $statut2label = array( |
59 | 67 | '' |
60 | 68 | ); |
61 | -foreach ($tmpstatut2label as $key => $val) |
|
69 | +foreach ($tmpstatut2label as $key => $val) { |
|
62 | 70 | $statut2label[$key] = $langs->trans($val); |
71 | +} |
|
63 | 72 | |
64 | 73 | $errors = array(); |
65 | 74 | |
@@ -95,9 +104,11 @@ discard block |
||
95 | 104 | { |
96 | 105 | $result = $db->query($sql); |
97 | 106 | $nbtotalofrecords = $db->num_rows($result); |
98 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
107 | + if (($page * $limit) > $nbtotalofrecords) { |
|
108 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
99 | 109 | { |
100 | 110 | $page = 0; |
111 | + } |
|
101 | 112 | $offset = 0; |
102 | 113 | } |
103 | 114 | } |
@@ -64,24 +64,24 @@ discard block |
||
64 | 64 | |
65 | 65 | if ($action == 'validate') |
66 | 66 | { |
67 | - $now = dol_now(); |
|
68 | - |
|
69 | - // Update database |
|
70 | - $db->begin(); |
|
71 | - $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; |
|
72 | - $sql .= " SET b.date_validated = '".$db->idate($now)."'"; |
|
73 | - $sql .= ' WHERE b.date_validated IS NULL'; |
|
74 | - |
|
75 | - dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG); |
|
76 | - $resql = $db->query($sql); |
|
77 | - if (!$resql1) { |
|
78 | - $error++; |
|
79 | - $db->rollback(); |
|
80 | - setEventMessages($db->lasterror(), null, 'errors'); |
|
81 | - } else { |
|
82 | - $db->commit(); |
|
83 | - } |
|
84 | - // End clean database |
|
67 | + $now = dol_now(); |
|
68 | + |
|
69 | + // Update database |
|
70 | + $db->begin(); |
|
71 | + $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; |
|
72 | + $sql .= " SET b.date_validated = '".$db->idate($now)."'"; |
|
73 | + $sql .= ' WHERE b.date_validated IS NULL'; |
|
74 | + |
|
75 | + dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG); |
|
76 | + $resql = $db->query($sql); |
|
77 | + if (!$resql1) { |
|
78 | + $error++; |
|
79 | + $db->rollback(); |
|
80 | + setEventMessages($db->lasterror(), null, 'errors'); |
|
81 | + } else { |
|
82 | + $db->commit(); |
|
83 | + } |
|
84 | + // End clean database |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | while ($row = $db->fetch_row($resql)) { |
137 | 137 | for ($i = 1; $i <= 12; $i++) { |
138 | 138 | print '<td class="nowrap center">'.$row[$i].'<br><br>'; |
139 | - print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected ? ' checked="checked"' : '').'>'; |
|
140 | - print '</td>'; |
|
139 | + print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected ? ' checked="checked"' : '').'>'; |
|
140 | + print '</td>'; |
|
141 | 141 | } |
142 | 142 | print '<td class="valigntop"><b>'.$row[13].'</b></td>'; |
143 | 143 | } |
@@ -34,17 +34,23 @@ discard block |
||
34 | 34 | if (empty($conf->accounting->enabled)) { |
35 | 35 | accessforbidden(); |
36 | 36 | } |
37 | -if ($user->socid > 0) |
|
38 | - accessforbidden(); |
|
39 | - if (!$user->rights->accounting->fiscalyear->write) |
|
37 | +if ($user->socid > 0) { |
|
40 | 38 | accessforbidden(); |
39 | +} |
|
40 | + if (!$user->rights->accounting->fiscalyear->write) { |
|
41 | + accessforbidden(); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | |
43 | 45 | $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); |
44 | -if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); |
|
45 | -else { |
|
46 | +if (GETPOST("year", 'int')) { |
|
47 | + $year_start = GETPOST("year", 'int'); |
|
48 | +} else { |
|
46 | 49 | $year_start = dol_print_date(dol_now(), '%Y'); |
47 | - if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year |
|
50 | + if (dol_print_date(dol_now(), '%m') < $month_start) { |
|
51 | + $year_start--; |
|
52 | + } |
|
53 | + // If current month is lower that starting fiscal month, we start last year |
|
48 | 54 | } |
49 | 55 | $year_end = $year_start + 1; |
50 | 56 | $month_end = $month_start - 1; |
@@ -109,7 +115,9 @@ discard block |
||
109 | 115 | print '<tr class="oddeven">'; |
110 | 116 | for ($i = 1; $i <= 12; $i++) { |
111 | 117 | $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; |
112 | - if ($j > 12) $j -= 12; |
|
118 | + if ($j > 12) { |
|
119 | + $j -= 12; |
|
120 | + } |
|
113 | 121 | print '<td class="center">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>'; |
114 | 122 | } |
115 | 123 | print '<td><b>'.$langs->trans("Total").'</b></td></tr>'; |
@@ -118,7 +126,9 @@ discard block |
||
118 | 126 | $sql = "SELECT COUNT(b.rowid) as detail,"; |
119 | 127 | for ($i = 1; $i <= 12; $i++) { |
120 | 128 | $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; |
121 | - if ($j > 12) $j -= 12; |
|
129 | + if ($j > 12) { |
|
130 | + $j -= 12; |
|
131 | + } |
|
122 | 132 | $sql .= " SUM(".$db->ifsql('MONTH(b.doc_date)='.$j, '1', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).","; |
123 | 133 | } |
124 | 134 | $sql .= " COUNT(b.rowid) as total"; |
@@ -1056,7 +1056,7 @@ |
||
1056 | 1056 | if ($object->format == "D") { |
1057 | 1057 | $meilleursujetexport = $toutsujet[$i]; |
1058 | 1058 | //var_dump($toutsujet); |
1059 | - if (strpos($toutsujet[$i], '@') !== false) { |
|
1059 | + if (strpos($toutsujet[$i], '@') !== false) { |
|
1060 | 1060 | $toutsujetdate = explode("@", $toutsujet[$i]); |
1061 | 1061 | $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').($toutsujetdate[0] ? ' ('.dol_print_date($toutsujetdate[0], '%A').')' : '').' - '.$toutsujetdate[1]; |
1062 | 1062 | } else { |
@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | // Security check |
34 | -if (!$user->rights->opensurvey->read) accessforbidden(); |
|
34 | +if (!$user->rights->opensurvey->read) { |
|
35 | + accessforbidden(); |
|
36 | +} |
|
35 | 37 | |
36 | 38 | |
37 | 39 | // Init vars |
@@ -40,7 +42,9 @@ discard block |
||
40 | 42 | |
41 | 43 | $object = new Opensurveysondage($db); |
42 | 44 | $result = $object->fetch(0, $numsondage); |
43 | -if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage); |
|
45 | +if ($result <= 0) { |
|
46 | + dol_print_error('', 'Failed to get survey id '.$numsondage); |
|
47 | +} |
|
44 | 48 | |
45 | 49 | $nblines = $object->fetch_lines(); |
46 | 50 | |
@@ -58,11 +62,13 @@ discard block |
||
58 | 62 | $nbcolonnes = substr_count($object->sujet, ',') + 1; |
59 | 63 | |
60 | 64 | // Add vote |
61 | -if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // boutonp for chrome, boutonp.x for firefox |
|
65 | +if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { |
|
66 | + // boutonp for chrome, boutonp.x for firefox |
|
62 | 67 | { |
63 | 68 | if (GETPOST('nom')) |
64 | 69 | { |
65 | 70 | $erreur_prenom = false; |
71 | +} |
|
66 | 72 | |
67 | 73 | $nouveauchoix = ''; |
68 | 74 | for ($i = 0; $i < $nbcolonnes; $i++) |
@@ -95,7 +101,9 @@ discard block |
||
95 | 101 | $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; |
96 | 102 | $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
97 | 103 | $resql = $db->query($sql); |
98 | - if (!$resql) dol_print_error($db); |
|
104 | + if (!$resql) { |
|
105 | + dol_print_error($db); |
|
106 | + } |
|
99 | 107 | } |
100 | 108 | } |
101 | 109 | } |
@@ -122,7 +130,9 @@ discard block |
||
122 | 130 | if ($testmodifier) |
123 | 131 | { |
124 | 132 | // Security check |
125 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
133 | + if (!$user->rights->opensurvey->write) { |
|
134 | + accessforbidden(); |
|
135 | + } |
|
126 | 136 | |
127 | 137 | $nouveauchoix = ''; |
128 | 138 | for ($i = 0; $i < $nbcolonnes; $i++) |
@@ -145,14 +155,18 @@ discard block |
||
145 | 155 | $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
146 | 156 | |
147 | 157 | $resql = $db->query($sql); |
148 | - if (!$resql) dol_print_error($db); |
|
149 | -} |
|
158 | + if (!$resql) { |
|
159 | + dol_print_error($db); |
|
160 | + } |
|
161 | + } |
|
150 | 162 | |
151 | 163 | // Add column (not for date) |
152 | 164 | if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format == "A") |
153 | 165 | { |
154 | 166 | // Security check |
155 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
167 | + if (!$user->rights->opensurvey->write) { |
|
168 | + accessforbidden(); |
|
169 | + } |
|
156 | 170 | |
157 | 171 | $nouveauxsujets = $object->sujet; |
158 | 172 | |
@@ -165,8 +179,9 @@ discard block |
||
165 | 179 | $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."'"; |
166 | 180 | $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
167 | 181 | $resql = $db->query($sql); |
168 | - if (!$resql) dol_print_error($db); |
|
169 | - else { |
|
182 | + if (!$resql) { |
|
183 | + dol_print_error($db); |
|
184 | + } else { |
|
170 | 185 | header('Location: results.php?id='.$object->id_sondage); |
171 | 186 | } |
172 | 187 | } |
@@ -175,7 +190,9 @@ discard block |
||
175 | 190 | if (isset($_POST["ajoutercolonne"]) && $object->format == "D") |
176 | 191 | { |
177 | 192 | // Security check |
178 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
193 | + if (!$user->rights->opensurvey->write) { |
|
194 | + accessforbidden(); |
|
195 | + } |
|
179 | 196 | |
180 | 197 | $nouveauxsujets = $object->sujet; |
181 | 198 | |
@@ -248,8 +265,9 @@ discard block |
||
248 | 265 | $sql .= " SET sujet = '".$db->escape($dateinsertion)."'"; |
249 | 266 | $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
250 | 267 | $resql = $db->query($sql); |
251 | - if (!$resql) dol_print_error($db); |
|
252 | - else { |
|
268 | + if (!$resql) { |
|
269 | + dol_print_error($db); |
|
270 | + } else { |
|
253 | 271 | header('Location: results.php?id='.$object->id_sondage); |
254 | 272 | } |
255 | 273 | } |
@@ -263,10 +281,12 @@ discard block |
||
263 | 281 | // Delete line |
264 | 282 | for ($i = 0; $i < $nblines; $i++) |
265 | 283 | { |
266 | - if (GETPOST("effaceligne".$i) || GETPOST("effaceligne".$i."_x") || GETPOST("effaceligne".$i.".x")) // effacelignei for chrome, effacelignei_x for firefox |
|
284 | + if (GETPOST("effaceligne".$i) || GETPOST("effaceligne".$i."_x") || GETPOST("effaceligne".$i.".x")) { |
|
285 | + // effacelignei for chrome, effacelignei_x for firefox |
|
267 | 286 | { |
268 | 287 | // Security check |
269 | 288 | if (!$user->rights->opensurvey->write) accessforbidden(); |
289 | + } |
|
270 | 290 | |
271 | 291 | $compteur = 0; |
272 | 292 | |
@@ -276,7 +296,9 @@ discard block |
||
276 | 296 | $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; |
277 | 297 | $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
278 | 298 | $resql = $db->query($sql); |
279 | - if (!$resql) dol_print_error($db); |
|
299 | + if (!$resql) { |
|
300 | + dol_print_error($db); |
|
301 | + } |
|
280 | 302 | $num = $db->num_rows($resql); |
281 | 303 | while ($compteur < $num) |
282 | 304 | { |
@@ -298,10 +320,12 @@ discard block |
||
298 | 320 | for ($i = 0; $i < $nbcolonnes; $i++) |
299 | 321 | { |
300 | 322 | if ((GETPOST("effacecolonne".$i) || GETPOST("effacecolonne".$i."_x") || GETPOST("effacecolonne".$i.".x")) |
301 | - && $nbcolonnes > 1) // effacecolonnei for chrome, effacecolonnei_x for firefox |
|
323 | + && $nbcolonnes > 1) { |
|
324 | + // effacecolonnei for chrome, effacecolonnei_x for firefox |
|
302 | 325 | { |
303 | 326 | // Security check |
304 | 327 | if (!$user->rights->opensurvey->write) accessforbidden(); |
328 | + } |
|
305 | 329 | |
306 | 330 | $db->begin(); |
307 | 331 | |
@@ -315,7 +339,9 @@ discard block |
||
315 | 339 | //si le sujet n'est pas celui qui a été effacé alors on concatene |
316 | 340 | if ($i != $j) |
317 | 341 | { |
318 | - if (!empty($nouveauxsujets)) $nouveauxsujets .= ','; |
|
342 | + if (!empty($nouveauxsujets)) { |
|
343 | + $nouveauxsujets .= ','; |
|
344 | + } |
|
319 | 345 | $nouveauxsujets .= $toutsujet[$j]; |
320 | 346 | } |
321 | 347 | |
@@ -326,7 +352,9 @@ discard block |
||
326 | 352 | $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; |
327 | 353 | $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'"; |
328 | 354 | $resql = $db->query($sql); |
329 | - if (!$resql) dol_print_error($db); |
|
355 | + if (!$resql) { |
|
356 | + dol_print_error($db); |
|
357 | + } |
|
330 | 358 | |
331 | 359 | // Clean current answer to remove deleted columns |
332 | 360 | $compteur = 0; |
@@ -450,11 +478,14 @@ discard block |
||
450 | 478 | |
451 | 479 | // Expire date |
452 | 480 | print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">'; |
453 | -if ($action == 'edit') print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); |
|
454 | -else { |
|
481 | +if ($action == 'edit') { |
|
482 | + print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); |
|
483 | +} else { |
|
455 | 484 | print dol_print_date($object->date_fin, 'day'); |
456 | - if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) print img_warning($langs->trans("Expired")); |
|
457 | -} |
|
485 | + if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) { |
|
486 | + print img_warning($langs->trans("Expired")); |
|
487 | + } |
|
488 | + } |
|
458 | 489 | print '</td></tr>'; |
459 | 490 | |
460 | 491 | // Author |
@@ -512,7 +543,9 @@ discard block |
||
512 | 543 | if (GETPOST('ajoutsujet')) |
513 | 544 | { |
514 | 545 | // Security check |
515 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
546 | + if (!$user->rights->opensurvey->write) { |
|
547 | + accessforbidden(); |
|
548 | + } |
|
516 | 549 | |
517 | 550 | print '<form name="formulaire" action="" method="POST">'."\n"; |
518 | 551 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
@@ -651,15 +684,21 @@ discard block |
||
651 | 684 | } |
652 | 685 | |
653 | 686 | $currenty = 0; |
654 | - if ($current) $currenty = strftime("%Y", $current); |
|
687 | + if ($current) { |
|
688 | + $currenty = strftime("%Y", $current); |
|
689 | + } |
|
655 | 690 | $next = 0; |
656 | - if ($next) $nexty = strftime("%Y", $next); |
|
691 | + if ($next) { |
|
692 | + $nexty = strftime("%Y", $next); |
|
693 | + } |
|
657 | 694 | if (isset($toutsujet[$i + 1]) && ($currenty == $nexty)) |
658 | 695 | { |
659 | 696 | $colspan++; |
660 | 697 | } else { |
661 | 698 | print '<td colspan='.$colspan.' class="annee">'; |
662 | - if ($current) print strftime("%Y", $current); |
|
699 | + if ($current) { |
|
700 | + print strftime("%Y", $current); |
|
701 | + } |
|
663 | 702 | print '</td>'."\n"; |
664 | 703 | $colspan = 1; |
665 | 704 | } |
@@ -805,33 +844,64 @@ discard block |
||
805 | 844 | |
806 | 845 | if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
807 | 846 | { |
808 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
809 | - else print '<td class="non">KO</td>'."\n"; |
|
847 | + if (((string) $car) == "1") { |
|
848 | + print '<td class="ok">OK</td>'."\n"; |
|
849 | + } else { |
|
850 | + print '<td class="non">KO</td>'."\n"; |
|
851 | + } |
|
810 | 852 | // Total |
811 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
812 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
853 | + if (!isset($sumfor[$i])) { |
|
854 | + $sumfor[$i] = 0; |
|
855 | + } |
|
856 | + if (((string) $car) == "1") { |
|
857 | + $sumfor[$i]++; |
|
858 | + } |
|
813 | 859 | } |
814 | 860 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
815 | 861 | { |
816 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
817 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
818 | - else print '<td class="vide"> </td>'."\n"; |
|
862 | + if (((string) $car) == "1") { |
|
863 | + print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
864 | + } elseif (((string) $car) == "0") { |
|
865 | + print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
866 | + } else { |
|
867 | + print '<td class="vide"> </td>'."\n"; |
|
868 | + } |
|
819 | 869 | // Total |
820 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
821 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
822 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
823 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
870 | + if (!isset($sumfor[$i])) { |
|
871 | + $sumfor[$i] = 0; |
|
872 | + } |
|
873 | + if (!isset($sumagainst[$i])) { |
|
874 | + $sumagainst[$i] = 0; |
|
875 | + } |
|
876 | + if (((string) $car) == "1") { |
|
877 | + $sumfor[$i]++; |
|
878 | + } |
|
879 | + if (((string) $car) == "0") { |
|
880 | + $sumagainst[$i]++; |
|
881 | + } |
|
824 | 882 | } |
825 | 883 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
826 | 884 | { |
827 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
828 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
829 | - else print '<td class="vide"> </td>'."\n"; |
|
885 | + if (((string) $car) == "1") { |
|
886 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
887 | + } elseif (((string) $car) == "0") { |
|
888 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
889 | + } else { |
|
890 | + print '<td class="vide"> </td>'."\n"; |
|
891 | + } |
|
830 | 892 | // Total |
831 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
832 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
833 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
834 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
893 | + if (!isset($sumfor[$i])) { |
|
894 | + $sumfor[$i] = 0; |
|
895 | + } |
|
896 | + if (!isset($sumagainst[$i])) { |
|
897 | + $sumagainst[$i] = 0; |
|
898 | + } |
|
899 | + if (((string) $car) == "1") { |
|
900 | + $sumfor[$i]++; |
|
901 | + } |
|
902 | + if (((string) $car) == "0") { |
|
903 | + $sumagainst[$i]++; |
|
904 | + } |
|
835 | 905 | } |
836 | 906 | } |
837 | 907 | } else { |
@@ -845,7 +915,9 @@ discard block |
||
845 | 915 | if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
846 | 916 | { |
847 | 917 | print '<input type="checkbox" name="choix'.$i.'" value="1" '; |
848 | - if ($car == '1') print 'checked'; |
|
918 | + if ($car == '1') { |
|
919 | + print 'checked'; |
|
920 | + } |
|
849 | 921 | print '>'; |
850 | 922 | } |
851 | 923 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
@@ -866,33 +938,64 @@ discard block |
||
866 | 938 | $car = substr($ensemblereponses, $i, 1); |
867 | 939 | if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
868 | 940 | { |
869 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
870 | - else print '<td class="non">KO</td>'."\n"; |
|
941 | + if (((string) $car) == "1") { |
|
942 | + print '<td class="ok">OK</td>'."\n"; |
|
943 | + } else { |
|
944 | + print '<td class="non">KO</td>'."\n"; |
|
945 | + } |
|
871 | 946 | // Total |
872 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
873 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
947 | + if (!isset($sumfor[$i])) { |
|
948 | + $sumfor[$i] = 0; |
|
949 | + } |
|
950 | + if (((string) $car) == "1") { |
|
951 | + $sumfor[$i]++; |
|
952 | + } |
|
874 | 953 | } |
875 | 954 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
876 | 955 | { |
877 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
878 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
879 | - else print '<td class="vide"> </td>'."\n"; |
|
956 | + if (((string) $car) == "1") { |
|
957 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
958 | + } elseif (((string) $car) == "0") { |
|
959 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
960 | + } else { |
|
961 | + print '<td class="vide"> </td>'."\n"; |
|
962 | + } |
|
880 | 963 | // Total |
881 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
882 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
883 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
884 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
964 | + if (!isset($sumfor[$i])) { |
|
965 | + $sumfor[$i] = 0; |
|
966 | + } |
|
967 | + if (!isset($sumagainst[$i])) { |
|
968 | + $sumagainst[$i] = 0; |
|
969 | + } |
|
970 | + if (((string) $car) == "1") { |
|
971 | + $sumfor[$i]++; |
|
972 | + } |
|
973 | + if (((string) $car) == "0") { |
|
974 | + $sumagainst[$i]++; |
|
975 | + } |
|
885 | 976 | } |
886 | 977 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
887 | 978 | { |
888 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
889 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
890 | - else print '<td class="vide"> </td>'."\n"; |
|
979 | + if (((string) $car) == "1") { |
|
980 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
981 | + } elseif (((string) $car) == "0") { |
|
982 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
983 | + } else { |
|
984 | + print '<td class="vide"> </td>'."\n"; |
|
985 | + } |
|
891 | 986 | // Total |
892 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
893 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
894 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
895 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
987 | + if (!isset($sumfor[$i])) { |
|
988 | + $sumfor[$i] = 0; |
|
989 | + } |
|
990 | + if (!isset($sumagainst[$i])) { |
|
991 | + $sumagainst[$i] = 0; |
|
992 | + } |
|
993 | + if (((string) $car) == "1") { |
|
994 | + $sumfor[$i]++; |
|
995 | + } |
|
996 | + if (((string) $car) == "0") { |
|
997 | + $sumagainst[$i]++; |
|
998 | + } |
|
896 | 999 | } |
897 | 1000 | } |
898 | 1001 | } |
@@ -966,8 +1069,9 @@ discard block |
||
966 | 1069 | $nbofcheckbox = 0; |
967 | 1070 | for ($i = 0; $i < $nbcolonnes + 1; $i++) |
968 | 1071 | { |
969 | - if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
970 | - $nbofcheckbox++; |
|
1072 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { |
|
1073 | + $nbofcheckbox++; |
|
1074 | + } |
|
971 | 1075 | if (isset($sumfor[$i])) |
972 | 1076 | { |
973 | 1077 | if ($i == 0) |
@@ -990,13 +1094,23 @@ discard block |
||
990 | 1094 | { |
991 | 1095 | $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : ''; |
992 | 1096 | $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : ''; |
993 | - if (empty($showsumfor)) $showsumfor = 0; |
|
994 | - if (empty($showsumagainst)) $showsumagainst = 0; |
|
1097 | + if (empty($showsumfor)) { |
|
1098 | + $showsumfor = 0; |
|
1099 | + } |
|
1100 | + if (empty($showsumagainst)) { |
|
1101 | + $showsumagainst = 0; |
|
1102 | + } |
|
995 | 1103 | |
996 | 1104 | print '<td>'; |
997 | - if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor; |
|
998 | - if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
999 | - if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
1105 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { |
|
1106 | + print $showsumfor; |
|
1107 | + } |
|
1108 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { |
|
1109 | + print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
1110 | + } |
|
1111 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { |
|
1112 | + print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
1113 | + } |
|
1000 | 1114 | print '</td>'."\n"; |
1001 | 1115 | } |
1002 | 1116 | print '</tr>'; |