@@ -211,14 +211,14 @@ |
||
| 211 | 211 | $i = 0; |
| 212 | 212 | while ($i < $num) { |
| 213 | 213 | $obj = $db->fetch_object($result); |
| 214 | - if (!isset($permsgroupbyentity[$obj->entity])) |
|
| 215 | - $permsgroupbyentity[$obj->entity] = array(); |
|
| 214 | + if (!isset($permsgroupbyentity[$obj->entity])) { |
|
| 215 | + $permsgroupbyentity[$obj->entity] = array(); |
|
| 216 | + } |
|
| 216 | 217 | array_push($permsgroupbyentity[$obj->entity], $obj->fk_id); |
| 217 | 218 | $i++; |
| 218 | 219 | } |
| 219 | 220 | $db->free($result); |
| 220 | -} |
|
| 221 | -else { |
|
| 221 | +} else { |
|
| 222 | 222 | dol_print_error($db); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -54,7 +54,10 @@ discard block |
||
| 54 | 54 | $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; |
| 55 | 55 | $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; |
| 56 | 56 | $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; |
| 57 | -if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // Force db type (for test purpose, by PHP unit for example) |
|
| 57 | +if (defined('TEST_DB_FORCE_TYPE')) { |
|
| 58 | + $conf->db->type=constant('TEST_DB_FORCE_TYPE'); |
|
| 59 | +} |
|
| 60 | +// Force db type (for test purpose, by PHP unit for example) |
|
| 58 | 61 | |
| 59 | 62 | // Set properties specific to conf file |
| 60 | 63 | $conf->file->main_limit_users = $dolibarr_main_limit_users; |
@@ -71,8 +74,9 @@ discard block |
||
| 71 | 74 | // dolibarr_main_document_root_alt can contains several directories |
| 72 | 75 | $values=preg_split('/[;,]/',$dolibarr_main_document_root_alt); |
| 73 | 76 | $i=0; |
| 74 | - foreach ($values as $value) |
|
| 75 | - $conf->file->dol_document_root['alt' . ($i++)] = (string)$value; |
|
| 77 | + foreach ($values as $value) { |
|
| 78 | + $conf->file->dol_document_root['alt' . ($i++)] = (string)$value; |
|
| 79 | + } |
|
| 76 | 80 | $values=preg_split('/[;,]/',$dolibarr_main_url_root_alt); |
| 77 | 81 | $i=0; |
| 78 | 82 | foreach($values as $value) |
@@ -98,9 +102,16 @@ discard block |
||
| 98 | 102 | } |
| 99 | 103 | |
| 100 | 104 | // Chargement des includes principaux de librairies communes |
| 101 | -if (! defined('NOREQUIREUSER')) require_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; // Need 500ko memory |
|
| 102 | -if (! defined('NOREQUIRETRAN')) require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php'; |
|
| 103 | -if (! defined('NOREQUIRESOC')) require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; |
|
| 105 | +if (! defined('NOREQUIREUSER')) { |
|
| 106 | + require_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; |
|
| 107 | +} |
|
| 108 | +// Need 500ko memory |
|
| 109 | +if (! defined('NOREQUIRETRAN')) { |
|
| 110 | + require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php'; |
|
| 111 | +} |
|
| 112 | +if (! defined('NOREQUIRESOC')) { |
|
| 113 | + require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; |
|
| 114 | +} |
|
| 104 | 115 | |
| 105 | 116 | |
| 106 | 117 | /* |
@@ -143,25 +154,32 @@ discard block |
||
| 143 | 154 | */ |
| 144 | 155 | |
| 145 | 156 | // By default conf->entity is 1, but we change this if we ask another value. |
| 146 | -if (session_id() && ! empty($_SESSION["dol_entity"])) // Entity inside an opened session |
|
| 157 | +if (session_id() && ! empty($_SESSION["dol_entity"])) { |
|
| 158 | + // Entity inside an opened session |
|
| 147 | 159 | { |
| 148 | 160 | $conf->entity = $_SESSION["dol_entity"]; |
| 149 | 161 | } |
| 150 | -else if (! empty($_ENV["dol_entity"])) // Entity inside a CLI script |
|
| 162 | +} else if (! empty($_ENV["dol_entity"])) { |
|
| 163 | + // Entity inside a CLI script |
|
| 151 | 164 | { |
| 152 | 165 | $conf->entity = $_ENV["dol_entity"]; |
| 153 | 166 | } |
| 154 | -else if (isset($_POST["loginfunction"]) && GETPOST("entity",'int')) // Just after a login page |
|
| 167 | +} else if (isset($_POST["loginfunction"]) && GETPOST("entity",'int')) { |
|
| 168 | + // Just after a login page |
|
| 155 | 169 | { |
| 156 | 170 | $conf->entity = GETPOST("entity",'int'); |
| 157 | 171 | } |
| 158 | -else if (defined('DOLENTITY') && is_numeric(DOLENTITY)) // For public page with MultiCompany module |
|
| 172 | +} else if (defined('DOLENTITY') && is_numeric(DOLENTITY)) { |
|
| 173 | + // For public page with MultiCompany module |
|
| 159 | 174 | { |
| 160 | 175 | $conf->entity = DOLENTITY; |
| 161 | 176 | } |
| 177 | +} |
|
| 162 | 178 | |
| 163 | 179 | // Sanitize entity |
| 164 | -if (! is_numeric($conf->entity)) $conf->entity=1; |
|
| 180 | +if (! is_numeric($conf->entity)) { |
|
| 181 | + $conf->entity=1; |
|
| 182 | +} |
|
| 165 | 183 | |
| 166 | 184 | if (! defined('NOREQUIREDB')) |
| 167 | 185 | { |
@@ -193,11 +211,26 @@ discard block |
||
| 193 | 211 | if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) |
| 194 | 212 | { |
| 195 | 213 | $ok=0; |
| 196 | - if ((! session_id() || ! isset($_SESSION["dol_login"])) && ! isset($_POST["username"]) && ! empty($_SERVER["GATEWAY_INTERFACE"])) $ok=1; // We let working pages if not logged and inside a web browser (login form, to allow login by admin) |
|
| 197 | - elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1; // We let working pages that is a login submission (login submit, to allow login by admin) |
|
| 198 | - elseif (defined('NOREQUIREDB')) $ok=1; // We let working pages that don't need database access (xxx.css.php) |
|
| 199 | - elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) $ok=1; // We let working pages that ask to work even if only login enabled (logout.php) |
|
| 200 | - elseif (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1; // We let working if user is allowed admin |
|
| 214 | + if ((! session_id() || ! isset($_SESSION["dol_login"])) && ! isset($_POST["username"]) && ! empty($_SERVER["GATEWAY_INTERFACE"])) { |
|
| 215 | + $ok=1; |
|
| 216 | + } |
|
| 217 | + // We let working pages if not logged and inside a web browser (login form, to allow login by admin) |
|
| 218 | + elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) { |
|
| 219 | + $ok=1; |
|
| 220 | + } |
|
| 221 | + // We let working pages that is a login submission (login submit, to allow login by admin) |
|
| 222 | + elseif (defined('NOREQUIREDB')) { |
|
| 223 | + $ok=1; |
|
| 224 | + } |
|
| 225 | + // We let working pages that don't need database access (xxx.css.php) |
|
| 226 | + elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) { |
|
| 227 | + $ok=1; |
|
| 228 | + } |
|
| 229 | + // We let working pages that ask to work even if only login enabled (logout.php) |
|
| 230 | + elseif (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) { |
|
| 231 | + $ok=1; |
|
| 232 | + } |
|
| 233 | + // We let working if user is allowed admin |
|
| 201 | 234 | if (! $ok) |
| 202 | 235 | { |
| 203 | 236 | if (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED) |
@@ -206,8 +239,7 @@ discard block |
||
| 206 | 239 | print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n"; |
| 207 | 240 | $nexturl = BASE_URI . '?controller=user&method=logout'; |
| 208 | 241 | print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n"; |
| 209 | - } |
|
| 210 | - else |
|
| 242 | + } else |
|
| 211 | 243 | { |
| 212 | 244 | print 'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n"; |
| 213 | 245 | $nexturl = BASE_URI . '/'; |
@@ -226,15 +258,19 @@ discard block |
||
| 226 | 258 | $mysoc->setMysoc($conf); |
| 227 | 259 | |
| 228 | 260 | // For some countries, we need to invert our address with customer address |
| 229 | - if ($mysoc->country_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1; |
|
| 230 | -} |
|
| 261 | + if ($mysoc->country_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
| 262 | + $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1; |
|
| 263 | + } |
|
| 264 | + } |
|
| 231 | 265 | |
| 232 | 266 | |
| 233 | 267 | // Set default language (must be after the setValues setting global $conf->global->MAIN_LANG_DEFAULT. Page main.inc.php will overwrite langs->defaultlang with user value later) |
| 234 | 268 | if (! defined('NOREQUIRETRAN')) |
| 235 | 269 | { |
| 236 | 270 | $langcode=(GETPOST('lang','aZ09')?GETPOST('lang','aZ09',1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); |
| 237 | - if (defined('MAIN_LANG_DEFAULT')) $langcode=constant('MAIN_LANG_DEFAULT'); |
|
| 271 | + if (defined('MAIN_LANG_DEFAULT')) { |
|
| 272 | + $langcode=constant('MAIN_LANG_DEFAULT'); |
|
| 273 | + } |
|
| 238 | 274 | $langs->setDefaultLang($langcode); |
| 239 | 275 | } |
| 240 | 276 | |
@@ -244,5 +280,7 @@ discard block |
||
| 244 | 280 | $hookmanager=new HookManager($db); |
| 245 | 281 | |
| 246 | 282 | |
| 247 | -if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); |
|
| 283 | +if (! defined('MAIN_LABEL_MENTION_NPR') ) { |
|
| 284 | + define('MAIN_LABEL_MENTION_NPR','NPR'); |
|
| 285 | +} |
|
| 248 | 286 | |
@@ -53,13 +53,15 @@ discard block |
||
| 53 | 53 | $h++; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase |
|
| 56 | + if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status))) { |
|
| 57 | + // If margin is on and product on sell, we may need the cost price even if product os not on purchase |
|
| 57 | 58 | { |
| 58 | 59 | if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) |
| 59 | 60 | || (! empty($conf->margin->enabled) && $user->rights->margin->liretous) |
| 60 | 61 | ) |
| 61 | 62 | { |
| 62 | 63 | $head[$h][0] = BASE_URI . "?controller=product&method=fournisseurs&id=" . $object->id; |
| 64 | + } |
|
| 63 | 65 | $head[$h][1] = $langs->trans("BuyingPrices"); |
| 64 | 66 | $head[$h][2] = 'suppliers'; |
| 65 | 67 | $h++; |
@@ -82,7 +84,9 @@ discard block |
||
| 82 | 84 | $head[$h][1] = $langs->trans('AssociatedProducts'); |
| 83 | 85 | |
| 84 | 86 | $nbFatherAndChild = $object->hasFatherOrChild(); |
| 85 | - if ($nbFatherAndChild > 0) $head[$h][1].= ' <span class="badge">'.$nbFatherAndChild.'</span>'; |
|
| 87 | + if ($nbFatherAndChild > 0) { |
|
| 88 | + $head[$h][1].= ' <span class="badge">'.$nbFatherAndChild.'</span>'; |
|
| 89 | + } |
|
| 86 | 90 | $head[$h][2] = 'subproduct'; |
| 87 | 91 | $h++; |
| 88 | 92 | } |
@@ -111,17 +115,21 @@ discard block |
||
| 111 | 115 | $head[$h][1] = $langs->trans('ProductCombinations'); |
| 112 | 116 | $head[$h][2] = 'combinations'; |
| 113 | 117 | $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id); |
| 114 | - if ($nbVariant > 0) $head[$h][1].= ' <span class="badge">'.$nbVariant.'</span>'; |
|
| 118 | + if ($nbVariant > 0) { |
|
| 119 | + $head[$h][1].= ' <span class="badge">'.$nbVariant.'</span>'; |
|
| 120 | + } |
|
| 115 | 121 | } |
| 116 | 122 | |
| 117 | 123 | $h++; |
| 118 | 124 | } |
| 119 | 125 | |
| 120 | - if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option) |
|
| 126 | + if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) { |
|
| 127 | + // If physical product we can stock (or service with option) |
|
| 121 | 128 | { |
| 122 | 129 | if (! empty($conf->stock->enabled) && $user->rights->stock->lire) |
| 123 | 130 | { |
| 124 | 131 | $head[$h][0] = BASE_URI . "?controller=product/stock&method=product&id=" . $object->id; |
| 132 | + } |
|
| 125 | 133 | $head[$h][1] = $langs->trans("Stock"); |
| 126 | 134 | $head[$h][2] = 'stock'; |
| 127 | 135 | $h++; |
@@ -138,11 +146,17 @@ discard block |
||
| 138 | 146 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
| 139 | 147 | { |
| 140 | 148 | $nbNote = 0; |
| 141 | - if(!empty($object->note_private)) $nbNote++; |
|
| 142 | - if(!empty($object->note_public)) $nbNote++; |
|
| 149 | + if(!empty($object->note_private)) { |
|
| 150 | + $nbNote++; |
|
| 151 | + } |
|
| 152 | + if(!empty($object->note_public)) { |
|
| 153 | + $nbNote++; |
|
| 154 | + } |
|
| 143 | 155 | $head[$h][0] = BASE_URI . '?controller=product&method=note&id=' . $object->id; |
| 144 | 156 | $head[$h][1] = $langs->trans('Notes'); |
| 145 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 157 | + if ($nbNote > 0) { |
|
| 158 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 159 | + } |
|
| 146 | 160 | $head[$h][2] = 'note'; |
| 147 | 161 | $h++; |
| 148 | 162 | } |
@@ -150,18 +164,28 @@ discard block |
||
| 150 | 164 | // Attachments |
| 151 | 165 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 152 | 166 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 153 | - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 154 | - if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 167 | + if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) { |
|
| 168 | + $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 169 | + } |
|
| 170 | + if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) { |
|
| 171 | + $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 172 | + } |
|
| 155 | 173 | $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
| 156 | 174 | if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { |
| 157 | - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; |
|
| 158 | - if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; |
|
| 175 | + if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) { |
|
| 176 | + $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; |
|
| 177 | + } |
|
| 178 | + if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) { |
|
| 179 | + $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; |
|
| 180 | + } |
|
| 159 | 181 | $nbFiles += count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
| 160 | 182 | } |
| 161 | 183 | $nbLinks=Link::count($db, $object->element, $object->id); |
| 162 | 184 | $head[$h][0] = BASE_URI . '?controller=product&method=document&id=' . $object->id; |
| 163 | 185 | $head[$h][1] = $langs->trans('Documents'); |
| 164 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 186 | + if (($nbFiles+$nbLinks) > 0) { |
|
| 187 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 188 | + } |
|
| 165 | 189 | $head[$h][2] = 'documents'; |
| 166 | 190 | $h++; |
| 167 | 191 | |
@@ -210,7 +234,9 @@ discard block |
||
| 210 | 234 | $nbLinks=Link::count($db, $object->element, $object->id); |
| 211 | 235 | $head[$h][0] = BASE_URI . "?controller=product/stock&method=productlot_document&id=" . $object->id; |
| 212 | 236 | $head[$h][1] = $langs->trans("Documents"); |
| 213 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 237 | + if (($nbFiles+$nbLinks) > 0) { |
|
| 238 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 239 | + } |
|
| 214 | 240 | $head[$h][2] = 'documents'; |
| 215 | 241 | $h++; |
| 216 | 242 | |
@@ -335,7 +361,9 @@ discard block |
||
| 335 | 361 | { |
| 336 | 362 | $nblines++; |
| 337 | 363 | $ret=$product->load_stats_propale($socid); |
| 338 | - if ($ret < 0) dol_print_error($db); |
|
| 364 | + if ($ret < 0) { |
|
| 365 | + dol_print_error($db); |
|
| 366 | + } |
|
| 339 | 367 | $langs->load("propal"); |
| 340 | 368 | print '<tr><td>'; |
| 341 | 369 | print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>'; |
@@ -353,7 +381,9 @@ discard block |
||
| 353 | 381 | { |
| 354 | 382 | $nblines++; |
| 355 | 383 | $ret=$product->load_stats_proposal_supplier($socid); |
| 356 | - if ($ret < 0) dol_print_error($db); |
|
| 384 | + if ($ret < 0) { |
|
| 385 | + dol_print_error($db); |
|
| 386 | + } |
|
| 357 | 387 | $langs->load("propal"); |
| 358 | 388 | print '<tr><td>'; |
| 359 | 389 | print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("SupplierProposals").'</a>'; |
@@ -371,7 +401,9 @@ discard block |
||
| 371 | 401 | { |
| 372 | 402 | $nblines++; |
| 373 | 403 | $ret=$product->load_stats_commande($socid); |
| 374 | - if ($ret < 0) dol_print_error($db); |
|
| 404 | + if ($ret < 0) { |
|
| 405 | + dol_print_error($db); |
|
| 406 | + } |
|
| 375 | 407 | $langs->load("orders"); |
| 376 | 408 | print '<tr><td>'; |
| 377 | 409 | print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>'; |
@@ -389,7 +421,9 @@ discard block |
||
| 389 | 421 | { |
| 390 | 422 | $nblines++; |
| 391 | 423 | $ret=$product->load_stats_commande_fournisseur($socid); |
| 392 | - if ($ret < 0) dol_print_error($db); |
|
| 424 | + if ($ret < 0) { |
|
| 425 | + dol_print_error($db); |
|
| 426 | + } |
|
| 393 | 427 | $langs->load("orders"); |
| 394 | 428 | print '<tr><td>'; |
| 395 | 429 | print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>'; |
@@ -407,7 +441,9 @@ discard block |
||
| 407 | 441 | { |
| 408 | 442 | $nblines++; |
| 409 | 443 | $ret=$product->load_stats_facture($socid); |
| 410 | - if ($ret < 0) dol_print_error($db); |
|
| 444 | + if ($ret < 0) { |
|
| 445 | + dol_print_error($db); |
|
| 446 | + } |
|
| 411 | 447 | $langs->load("bills"); |
| 412 | 448 | print '<tr><td>'; |
| 413 | 449 | print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>'; |
@@ -425,7 +461,9 @@ discard block |
||
| 425 | 461 | { |
| 426 | 462 | $nblines++; |
| 427 | 463 | $ret=$product->load_stats_facture_fournisseur($socid); |
| 428 | - if ($ret < 0) dol_print_error($db); |
|
| 464 | + if ($ret < 0) { |
|
| 465 | + dol_print_error($db); |
|
| 466 | + } |
|
| 429 | 467 | $langs->load("bills"); |
| 430 | 468 | print '<tr><td>'; |
| 431 | 469 | print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>'; |
@@ -444,7 +482,9 @@ discard block |
||
| 444 | 482 | { |
| 445 | 483 | $nblines++; |
| 446 | 484 | $ret=$product->load_stats_contrat($socid); |
| 447 | - if ($ret < 0) dol_print_error($db); |
|
| 485 | + if ($ret < 0) { |
|
| 486 | + dol_print_error($db); |
|
| 487 | + } |
|
| 448 | 488 | $langs->load("contracts"); |
| 449 | 489 | print '<tr><td>'; |
| 450 | 490 | print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>'; |
@@ -483,8 +523,7 @@ discard block |
||
| 483 | 523 | $measuring_units[-6] = $langs->transnoentitiesnoconv("WeightUnitmg"); |
| 484 | 524 | $measuring_units[98] = $langs->transnoentitiesnoconv("WeightUnitounce"); |
| 485 | 525 | $measuring_units[99] = $langs->transnoentitiesnoconv("WeightUnitpound"); |
| 486 | - } |
|
| 487 | - else if ($measuring_style == 'size') |
|
| 526 | + } else if ($measuring_style == 'size') |
|
| 488 | 527 | { |
| 489 | 528 | $measuring_units[0] = $langs->transnoentitiesnoconv("SizeUnitm"); |
| 490 | 529 | $measuring_units[-1] = $langs->transnoentitiesnoconv("SizeUnitdm"); |
@@ -492,8 +531,7 @@ discard block |
||
| 492 | 531 | $measuring_units[-3] = $langs->transnoentitiesnoconv("SizeUnitmm"); |
| 493 | 532 | $measuring_units[98] = $langs->transnoentitiesnoconv("SizeUnitfoot"); |
| 494 | 533 | $measuring_units[99] = $langs->transnoentitiesnoconv("SizeUnitinch"); |
| 495 | - } |
|
| 496 | - else if ($measuring_style == 'surface') |
|
| 534 | + } else if ($measuring_style == 'surface') |
|
| 497 | 535 | { |
| 498 | 536 | $measuring_units[0] = $langs->transnoentitiesnoconv("SurfaceUnitm2"); |
| 499 | 537 | $measuring_units[-2] = $langs->transnoentitiesnoconv("SurfaceUnitdm2"); |
@@ -501,8 +539,7 @@ discard block |
||
| 501 | 539 | $measuring_units[-6] = $langs->transnoentitiesnoconv("SurfaceUnitmm2"); |
| 502 | 540 | $measuring_units[98] = $langs->transnoentitiesnoconv("SurfaceUnitfoot2"); |
| 503 | 541 | $measuring_units[99] = $langs->transnoentitiesnoconv("SurfaceUnitinch2"); |
| 504 | - } |
|
| 505 | - else if ($measuring_style == 'volume') |
|
| 542 | + } else if ($measuring_style == 'volume') |
|
| 506 | 543 | { |
| 507 | 544 | $measuring_units[0] = $langs->transnoentitiesnoconv("VolumeUnitm3"); |
| 508 | 545 | $measuring_units[-3] = $langs->transnoentitiesnoconv("VolumeUnitdm3"); |
@@ -74,7 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | 76 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some |
| 77 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 77 | +if ($reshook < 0) { |
|
| 78 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 79 | +} |
|
| 78 | 80 | |
| 79 | 81 | if ($action == 'update') |
| 80 | 82 | { |
@@ -122,7 +124,9 @@ discard block |
||
| 122 | 124 | |
| 123 | 125 | // Fill array 'array_options' with data from add form |
| 124 | 126 | $ret = $extrafields->setOptionalsFromPost($extralabels,$object); |
| 125 | - if ($ret < 0) $error++; |
|
| 127 | + if ($ret < 0) { |
|
| 128 | + $error++; |
|
| 129 | + } |
|
| 126 | 130 | |
| 127 | 131 | if ($object->update($user) > 0) |
| 128 | 132 | { |
@@ -176,15 +180,16 @@ discard block |
||
| 176 | 180 | |
| 177 | 181 | // Fill array 'array_options' with data from add form |
| 178 | 182 | $ret = $extrafields->setOptionalsFromPost($extralabels,$object); |
| 179 | - if ($ret < 0) $error++; |
|
| 183 | + if ($ret < 0) { |
|
| 184 | + $error++; |
|
| 185 | + } |
|
| 180 | 186 | |
| 181 | 187 | $res = $object->create($user); |
| 182 | 188 | if ($res > 0) |
| 183 | 189 | { |
| 184 | 190 | header("Location: " . $_SERVER['PHP_SELF'] . '&id=' . $res); |
| 185 | 191 | exit; |
| 186 | - } |
|
| 187 | - else |
|
| 192 | + } else |
|
| 188 | 193 | { |
| 189 | 194 | setEventMessages($object->error, $object->errors, 'errors'); |
| 190 | 195 | } |
@@ -198,8 +203,7 @@ discard block |
||
| 198 | 203 | { |
| 199 | 204 | header("Location: index.php"); |
| 200 | 205 | exit; |
| 201 | - } |
|
| 202 | - else |
|
| 206 | + } else |
|
| 203 | 207 | { |
| 204 | 208 | dol_syslog($object->error,LOG_DEBUG); |
| 205 | 209 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -214,8 +218,7 @@ discard block |
||
| 214 | 218 | |
| 215 | 219 | header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id); |
| 216 | 220 | exit; |
| 217 | - } |
|
| 218 | - else { |
|
| 221 | + } else { |
|
| 219 | 222 | setEventMessages($object->error, $object->errors, 'errors'); |
| 220 | 223 | } |
| 221 | 224 | } |
@@ -226,8 +229,7 @@ discard block |
||
| 226 | 229 | { |
| 227 | 230 | header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id); |
| 228 | 231 | exit; |
| 229 | - } |
|
| 230 | - else { |
|
| 232 | + } else { |
|
| 231 | 233 | setEventMessages($object->error, $object->errors, 'errors'); |
| 232 | 234 | } |
| 233 | 235 | } |
@@ -238,12 +240,10 @@ discard block |
||
| 238 | 240 | { |
| 239 | 241 | header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id); |
| 240 | 242 | exit; |
| 241 | - } |
|
| 242 | - else { |
|
| 243 | + } else { |
|
| 243 | 244 | setEventMessages($object->error, $object->errors, 'errors'); |
| 244 | 245 | } |
| 245 | -} |
|
| 246 | -else if ($action == 'classin' && $user->rights->don->creer) |
|
| 246 | +} else if ($action == 'classin' && $user->rights->don->creer) |
|
| 247 | 247 | { |
| 248 | 248 | $object->fetch($id); |
| 249 | 249 | $object->setProject($projectid); |
@@ -351,13 +351,14 @@ discard block |
||
| 351 | 351 | print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); |
| 352 | 352 | if ($soc->outstanding_limit != '') |
| 353 | 353 | { |
| 354 | - if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); |
|
| 354 | + if ($outstandingBills > $soc->outstanding_limit) { |
|
| 355 | + print img_warning($langs->trans("OutstandingBillReached")); |
|
| 356 | + } |
|
| 355 | 357 | print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); |
| 356 | 358 | } |
| 357 | 359 | print ')'; |
| 358 | 360 | print '</td>'; |
| 359 | - } |
|
| 360 | - else |
|
| 361 | + } else |
|
| 361 | 362 | { |
| 362 | 363 | print '<td colspan="2">'; |
| 363 | 364 | print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); |
@@ -413,7 +414,9 @@ discard block |
||
| 413 | 414 | // Country |
| 414 | 415 | print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">'; |
| 415 | 416 | print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); |
| 416 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 417 | + if ($user->admin) { |
|
| 418 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 419 | + } |
|
| 417 | 420 | print '</td></tr>'; |
| 418 | 421 | |
| 419 | 422 | print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>'; |
@@ -522,8 +525,7 @@ discard block |
||
| 522 | 525 | if ($object->statut == 0) |
| 523 | 526 | { |
| 524 | 527 | print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>'; |
| 525 | - } |
|
| 526 | - else |
|
| 528 | + } else |
|
| 527 | 529 | { |
| 528 | 530 | print '<tr><td>'.$langs->trans("Amount").'</td><td>'; |
| 529 | 531 | print price($object->amount,0,$langs,0,0,-1,$conf->currency); |
@@ -552,15 +554,20 @@ discard block |
||
| 552 | 554 | // Country |
| 553 | 555 | print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>'; |
| 554 | 556 | print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); |
| 555 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 557 | + if ($user->admin) { |
|
| 558 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 559 | + } |
|
| 556 | 560 | print '</td></tr>'; |
| 557 | 561 | |
| 558 | 562 | print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>'; |
| 559 | 563 | |
| 560 | 564 | // Payment mode |
| 561 | 565 | print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n"; |
| 562 | - if ($object->modepaymentid) $selected = $object->modepaymentid; |
|
| 563 | - else $selected = ''; |
|
| 566 | + if ($object->modepaymentid) { |
|
| 567 | + $selected = $object->modepaymentid; |
|
| 568 | + } else { |
|
| 569 | + $selected = ''; |
|
| 570 | + } |
|
| 564 | 571 | $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1); |
| 565 | 572 | print "</td></tr>\n"; |
| 566 | 573 | |
@@ -640,8 +647,9 @@ discard block |
||
| 640 | 647 | $morehtmlref.=$langs->trans('Project') . ' '; |
| 641 | 648 | if ($user->rights->don->creer) |
| 642 | 649 | { |
| 643 | - if ($action != 'classify') |
|
| 644 | - $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 650 | + if ($action != 'classify') { |
|
| 651 | + $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 652 | + } |
|
| 645 | 653 | if ($action == 'classify') { |
| 646 | 654 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
| 647 | 655 | $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
@@ -763,8 +771,7 @@ discard block |
||
| 763 | 771 | } |
| 764 | 772 | print "</table>"; |
| 765 | 773 | $db->free($resql); |
| 766 | - } |
|
| 767 | - else |
|
| 774 | + } else |
|
| 768 | 775 | { |
| 769 | 776 | dol_print_error($db); |
| 770 | 777 | } |
@@ -801,8 +808,7 @@ discard block |
||
| 801 | 808 | if ($remaintopay == 0) |
| 802 | 809 | { |
| 803 | 810 | print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>'; |
| 804 | - } |
|
| 805 | - else |
|
| 811 | + } else |
|
| 806 | 812 | { |
| 807 | 813 | print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=don/payment&method=payment&rowid=' . $object->id . '&action=create">' . $langs->trans('DoPayment') . '</a></div>'; |
| 808 | 814 | } |
@@ -821,13 +827,11 @@ discard block |
||
| 821 | 827 | { |
| 822 | 828 | // TODO: Original href="card.php?rowid='.$object->id.'&action=delete" |
| 823 | 829 | print '<div class="inline-block divButAction"><a class="butActionDelete" href="?controller=don&method=card&rowid=' . $object->id . '&action=delete">' . $langs->trans("Delete") . "</a></div>"; |
| 824 | - } |
|
| 825 | - else |
|
| 830 | + } else |
|
| 826 | 831 | { |
| 827 | 832 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>"; |
| 828 | 833 | } |
| 829 | - } |
|
| 830 | - else |
|
| 834 | + } else |
|
| 831 | 835 | { |
| 832 | 836 | print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>"; |
| 833 | 837 | } |
@@ -855,9 +859,11 @@ discard block |
||
| 855 | 859 | // Show online payment link |
| 856 | 860 | $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); |
| 857 | 861 | |
| 858 | - if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT && |
|
| 862 | + if ($useonlinepayment) { |
|
| 863 | + //$object->statut != Facture::STATUS_DRAFT && |
|
| 859 | 864 | { |
| 860 | 865 | print '<br><!-- Link to pay -->'."\n"; |
| 866 | + } |
|
| 861 | 867 | require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; |
| 862 | 868 | print showOnlinePaymentUrl('donation', $object->ref).'<br>'; |
| 863 | 869 | } |
@@ -116,26 +116,47 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // Clean parameters |
| 119 | - if (isset($this->fk_donation)) $this->fk_donation = trim($this->fk_donation); |
|
| 120 | - if (isset($this->amount)) $this->amount = trim($this->amount); |
|
| 121 | - if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment); |
|
| 122 | - if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); |
|
| 123 | - if (isset($this->note)) $this->note = trim($this->note); |
|
| 124 | - if (isset($this->fk_bank)) $this->fk_bank = trim($this->fk_bank); |
|
| 125 | - if (isset($this->fk_user_creat)) $this->fk_user_creat = trim($this->fk_user_creat); |
|
| 126 | - if (isset($this->fk_user_modif)) $this->fk_user_modif = trim($this->fk_user_modif); |
|
| 119 | + if (isset($this->fk_donation)) { |
|
| 120 | + $this->fk_donation = trim($this->fk_donation); |
|
| 121 | + } |
|
| 122 | + if (isset($this->amount)) { |
|
| 123 | + $this->amount = trim($this->amount); |
|
| 124 | + } |
|
| 125 | + if (isset($this->fk_typepayment)) { |
|
| 126 | + $this->fk_typepayment = trim($this->fk_typepayment); |
|
| 127 | + } |
|
| 128 | + if (isset($this->num_payment)) { |
|
| 129 | + $this->num_payment = trim($this->num_payment); |
|
| 130 | + } |
|
| 131 | + if (isset($this->note)) { |
|
| 132 | + $this->note = trim($this->note); |
|
| 133 | + } |
|
| 134 | + if (isset($this->fk_bank)) { |
|
| 135 | + $this->fk_bank = trim($this->fk_bank); |
|
| 136 | + } |
|
| 137 | + if (isset($this->fk_user_creat)) { |
|
| 138 | + $this->fk_user_creat = trim($this->fk_user_creat); |
|
| 139 | + } |
|
| 140 | + if (isset($this->fk_user_modif)) { |
|
| 141 | + $this->fk_user_modif = trim($this->fk_user_modif); |
|
| 142 | + } |
|
| 127 | 143 | |
| 128 | 144 | $totalamount = 0; |
| 129 | - foreach ($this->amounts as $key => $value) // How payment is dispatch |
|
| 145 | + foreach ($this->amounts as $key => $value) { |
|
| 146 | + // How payment is dispatch |
|
| 130 | 147 | { |
| 131 | 148 | $newvalue = price2num($value, 'MT'); |
| 149 | + } |
|
| 132 | 150 | $this->amounts[$key] = $newvalue; |
| 133 | 151 | $totalamount += $newvalue; |
| 134 | 152 | } |
| 135 | 153 | $totalamount = price2num($totalamount); |
| 136 | 154 | |
| 137 | 155 | // Check parameters |
| 138 | - if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null |
|
| 156 | + if ($totalamount == 0) { |
|
| 157 | + return -1; |
|
| 158 | + } |
|
| 159 | + // On accepte les montants negatifs pour les rejets de prelevement mais pas null |
|
| 139 | 160 | |
| 140 | 161 | |
| 141 | 162 | $this->db->begin(); |
@@ -260,14 +281,30 @@ discard block |
||
| 260 | 281 | |
| 261 | 282 | // Clean parameters |
| 262 | 283 | |
| 263 | - if (isset($this->fk_donation)) $this->fk_donation = trim($this->fk_donation); |
|
| 264 | - if (isset($this->amount)) $this->amount = trim($this->amount); |
|
| 265 | - if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment); |
|
| 266 | - if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); |
|
| 267 | - if (isset($this->note)) $this->note = trim($this->note); |
|
| 268 | - if (isset($this->fk_bank)) $this->fk_bank = trim($this->fk_bank); |
|
| 269 | - if (isset($this->fk_user_creat)) $this->fk_user_creat = trim($this->fk_user_creat); |
|
| 270 | - if (isset($this->fk_user_modif)) $this->fk_user_modif = trim($this->fk_user_modif); |
|
| 284 | + if (isset($this->fk_donation)) { |
|
| 285 | + $this->fk_donation = trim($this->fk_donation); |
|
| 286 | + } |
|
| 287 | + if (isset($this->amount)) { |
|
| 288 | + $this->amount = trim($this->amount); |
|
| 289 | + } |
|
| 290 | + if (isset($this->fk_typepayment)) { |
|
| 291 | + $this->fk_typepayment = trim($this->fk_typepayment); |
|
| 292 | + } |
|
| 293 | + if (isset($this->num_payment)) { |
|
| 294 | + $this->num_payment = trim($this->num_payment); |
|
| 295 | + } |
|
| 296 | + if (isset($this->note)) { |
|
| 297 | + $this->note = trim($this->note); |
|
| 298 | + } |
|
| 299 | + if (isset($this->fk_bank)) { |
|
| 300 | + $this->fk_bank = trim($this->fk_bank); |
|
| 301 | + } |
|
| 302 | + if (isset($this->fk_user_creat)) { |
|
| 303 | + $this->fk_user_creat = trim($this->fk_user_creat); |
|
| 304 | + } |
|
| 305 | + if (isset($this->fk_user_modif)) { |
|
| 306 | + $this->fk_user_modif = trim($this->fk_user_modif); |
|
| 307 | + } |
|
| 271 | 308 | |
| 272 | 309 | // Check parameters |
| 273 | 310 | // Put here code to add control on parameters values |
@@ -522,7 +559,9 @@ discard block |
||
| 522 | 559 | $acc->fetch($accountid); |
| 523 | 560 | |
| 524 | 561 | $total = $this->total; |
| 525 | - if ($mode == 'payment_donation') $amount = $total; |
|
| 562 | + if ($mode == 'payment_donation') { |
|
| 563 | + $amount = $total; |
|
| 564 | + } |
|
| 526 | 565 | |
| 527 | 566 | // Insert payment into llx_bank |
| 528 | 567 | $bank_line_id = $acc->addline( |
@@ -548,7 +587,9 @@ discard block |
||
| 548 | 587 | |
| 549 | 588 | // Add link 'payment', 'payment_supplier', 'payment_donation' in bank_url between payment and bank transaction |
| 550 | 589 | $url = ''; |
| 551 | - if ($mode == 'payment_donation') $url = DOL_URL_ROOT . '/don/payment/card.php?rowid='; |
|
| 590 | + if ($mode == 'payment_donation') { |
|
| 591 | + $url = DOL_URL_ROOT . '/don/payment/card.php?rowid='; |
|
| 592 | + } |
|
| 552 | 593 | if ($url) { |
| 553 | 594 | $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); |
| 554 | 595 | if ($result <= 0) { |
@@ -606,16 +647,24 @@ discard block |
||
| 606 | 647 | |
| 607 | 648 | $result = ''; |
| 608 | 649 | |
| 609 | - if (empty($this->ref)) $this->ref = $this->lib; |
|
| 650 | + if (empty($this->ref)) { |
|
| 651 | + $this->ref = $this->lib; |
|
| 652 | + } |
|
| 610 | 653 | $label = $langs->trans("ShowPayment") . ': ' . $this->ref; |
| 611 | 654 | |
| 612 | 655 | if (!empty($this->id)) { |
| 613 | 656 | $link = '<a href="' . DOL_URL_ROOT . '/don/payment/card.php?id=' . $this->id . '" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">'; |
| 614 | 657 | $linkend = '</a>'; |
| 615 | 658 | |
| 616 | - if ($withpicto) $result .= ($link . img_object($label, 'payment', 'class="classfortooltip"') . $linkend . ' '); |
|
| 617 | - if ($withpicto && $withpicto != 2) $result .= ' '; |
|
| 618 | - if ($withpicto != 2) $result .= $link . ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref) . $linkend; |
|
| 659 | + if ($withpicto) { |
|
| 660 | + $result .= ($link . img_object($label, 'payment', 'class="classfortooltip"') . $linkend . ' '); |
|
| 661 | + } |
|
| 662 | + if ($withpicto && $withpicto != 2) { |
|
| 663 | + $result .= ' '; |
|
| 664 | + } |
|
| 665 | + if ($withpicto != 2) { |
|
| 666 | + $result .= $link . ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref) . $linkend; |
|
| 667 | + } |
|
| 619 | 668 | } |
| 620 | 669 | |
| 621 | 670 | return $result; |
@@ -47,7 +47,9 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // Security check |
| 49 | 49 | $socid=0; |
| 50 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 50 | +if ($user->societe_id) { |
|
| 51 | + $socid=$user->societe_id; |
|
| 52 | +} |
|
| 51 | 53 | $result=restrictedArea($user,'don',$id,''); |
| 52 | 54 | |
| 53 | 55 | $object = new Don($db); |
@@ -98,10 +100,11 @@ discard block |
||
| 98 | 100 | $morehtmlref.=$langs->trans('Project') . ' '; |
| 99 | 101 | if ($user->rights->don->creer) |
| 100 | 102 | { |
| 101 | - if ($action != 'classify') |
|
| 102 | - // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 103 | + if ($action != 'classify') { |
|
| 104 | + // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 103 | 105 | if ($action == 'classify') { |
| 104 | 106 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
| 107 | + } |
|
| 105 | 108 | $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
| 106 | 109 | $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 107 | 110 | $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
@@ -40,7 +40,9 @@ discard block |
||
| 40 | 40 | $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); |
| 41 | 41 | |
| 42 | 42 | // Security check |
| 43 | -if ($user->societe_id) $socid = $user->societe_id; |
|
| 43 | +if ($user->societe_id) { |
|
| 44 | + $socid = $user->societe_id; |
|
| 45 | +} |
|
| 44 | 46 | $result = restrictedArea($user, 'don', $id, ''); |
| 45 | 47 | |
| 46 | 48 | $object = new Don($db); |
@@ -79,10 +81,11 @@ discard block |
||
| 79 | 81 | $langs->load("projects"); |
| 80 | 82 | $morehtmlref .= $langs->trans('Project') . ' '; |
| 81 | 83 | if ($user->rights->don->creer) { |
| 82 | - if ($action != 'classify') |
|
| 83 | - // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 84 | + if ($action != 'classify') { |
|
| 85 | + // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 84 | 86 | if ($action == 'classify') { |
| 85 | 87 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
| 88 | + } |
|
| 86 | 89 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
| 87 | 90 | $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
| 88 | 91 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
@@ -54,7 +54,9 @@ discard block |
||
| 54 | 54 | $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); |
| 55 | 55 | |
| 56 | 56 | // Security check |
| 57 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 57 | +if ($user->societe_id) { |
|
| 58 | + $socid=$user->societe_id; |
|
| 59 | +} |
|
| 58 | 60 | $result = restrictedArea($user, 'don', $id, ''); |
| 59 | 61 | |
| 60 | 62 | |
@@ -66,8 +68,12 @@ discard block |
||
| 66 | 68 | $offset = $conf->liste_limit * $page; |
| 67 | 69 | $pageprev = $page - 1; |
| 68 | 70 | $pagenext = $page + 1; |
| 69 | -if (! $sortorder) $sortorder="ASC"; |
|
| 70 | -if (! $sortfield) $sortfield="name"; |
|
| 71 | +if (! $sortorder) { |
|
| 72 | + $sortorder="ASC"; |
|
| 73 | +} |
|
| 74 | +if (! $sortfield) { |
|
| 75 | + $sortfield="name"; |
|
| 76 | +} |
|
| 71 | 77 | |
| 72 | 78 | |
| 73 | 79 | $object = new Don($db); |
@@ -129,10 +135,11 @@ discard block |
||
| 129 | 135 | $morehtmlref.=$langs->trans('Project') . ' '; |
| 130 | 136 | if ($user->rights->don->creer) |
| 131 | 137 | { |
| 132 | - if ($action != 'classify') |
|
| 133 | - // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 138 | + if ($action != 'classify') { |
|
| 139 | + // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 134 | 140 | if ($action == 'classify') { |
| 135 | 141 | $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
| 142 | + } |
|
| 136 | 143 | $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
| 137 | 144 | $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 138 | 145 | $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
@@ -188,8 +195,7 @@ discard block |
||
| 188 | 195 | $permtoedit = $user->rights->don->creer; |
| 189 | 196 | $param = '&id=' . $object->id; |
| 190 | 197 | include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
| 191 | -} |
|
| 192 | -else |
|
| 198 | +} else |
|
| 193 | 199 | { |
| 194 | 200 | print $langs->trans("ErrorUnknown"); |
| 195 | 201 | } |
@@ -23,19 +23,21 @@ |
||
| 23 | 23 | |
| 24 | 24 | // define CDAV_CONTACT_TAG if not |
| 25 | 25 | if (!defined('CDAV_CONTACT_TAG')) { |
| 26 | - if (isset($conf->global->CDAV_CONTACT_TAG)) |
|
| 27 | - define('CDAV_CONTACT_TAG', $conf->global->CDAV_CONTACT_TAG); |
|
| 28 | - else |
|
| 29 | - define('CDAV_CONTACT_TAG', ''); |
|
| 30 | -} |
|
| 26 | + if (isset($conf->global->CDAV_CONTACT_TAG)) { |
|
| 27 | + define('CDAV_CONTACT_TAG', $conf->global->CDAV_CONTACT_TAG); |
|
| 28 | + } else { |
|
| 29 | + define('CDAV_CONTACT_TAG', ''); |
|
| 30 | + } |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | // define CDAV_URI_KEY if not |
| 33 | 34 | if (!defined('CDAV_URI_KEY')) { |
| 34 | - if (isset($conf->global->CDAV_URI_KEY)) |
|
| 35 | - define('CDAV_URI_KEY', $conf->global->CDAV_URI_KEY); |
|
| 36 | - else |
|
| 37 | - define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']), 0, 8)); |
|
| 38 | -} |
|
| 35 | + if (isset($conf->global->CDAV_URI_KEY)) { |
|
| 36 | + define('CDAV_URI_KEY', $conf->global->CDAV_URI_KEY); |
|
| 37 | + } else { |
|
| 38 | + define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']), 0, 8)); |
|
| 39 | + } |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | |
| 41 | 43 | /** |