@@ -27,26 +27,26 @@ discard block |
||
| 27 | 27 | * \ingroup commercial |
| 28 | 28 | * \brief Home page of commercial area |
| 29 | 29 | */ |
| 30 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 30 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 31 | 31 | |
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; |
|
| 34 | -require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/agenda.lib.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; |
|
| 36 | 36 | if (!empty($conf->contrat->enabled)) { |
| 37 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 37 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 38 | 38 | } |
| 39 | 39 | if (!empty($conf->propal->enabled)) { |
| 40 | - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 40 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 41 | 41 | } |
| 42 | 42 | if (!empty($conf->supplier_proposal->enabled)) { |
| 43 | - require_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; |
|
| 43 | + require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; |
|
| 44 | 44 | } |
| 45 | 45 | if (!empty($conf->commande->enabled)) { |
| 46 | - require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; |
|
| 46 | + require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
| 47 | 47 | } |
| 48 | 48 | if (!empty($conf->fournisseur->enabled)) { |
| 49 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; |
|
| 49 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | if (!$user->rights->societe->lire) { |
@@ -127,18 +127,18 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (count($listofsearchfields)) { |
| 130 | - print '<form method="post" action="' . BASE_URI . '?controller=core&method=search">'; |
|
| 131 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 130 | + print '<form method="post" action="'.BASE_URI.'?controller=core&method=search">'; |
|
| 131 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 132 | 132 | print '<table class="noborder nohover centpercent">'; |
| 133 | 133 | $i = 0; |
| 134 | 134 | foreach ($listofsearchfields as $key => $value) { |
| 135 | 135 | if ($i == 0) { |
| 136 | - print '<tr class="liste_titre"><td colspan="3">' . $langs->trans("Search") . '</td></tr>'; |
|
| 136 | + print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; |
|
| 137 | 137 | } |
| 138 | - print '<tr ' . $bc[false] . '>'; |
|
| 139 | - print '<td class="nowrap"><label for="' . $key . '">' . $langs->trans($value["text"]) . '</label></td><td><input type="text" class="flat inputsearch" name="' . $key . '" id="' . $key . '" size="18"></td>'; |
|
| 138 | + print '<tr '.$bc[false].'>'; |
|
| 139 | + print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>'; |
|
| 140 | 140 | if ($i == 0) { |
| 141 | - print '<td class="noborderbottom" rowspan="' . count($listofsearchfields) . '"><input type="submit" value="' . $langs->trans("Search") . '" class="button "></td>'; |
|
| 141 | + print '<td class="noborderbottom" rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button "></td>'; |
|
| 142 | 142 | } |
| 143 | 143 | print '</tr>'; |
| 144 | 144 | $i++; |
@@ -158,19 +158,19 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; |
| 160 | 160 | $sql .= ", s.code_client"; |
| 161 | - $sql .= " FROM " . MAIN_DB_PREFIX . "propal as p"; |
|
| 162 | - $sql .= ", " . MAIN_DB_PREFIX . "societe as s"; |
|
| 161 | + $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; |
|
| 162 | + $sql .= ", ".MAIN_DB_PREFIX."societe as s"; |
|
| 163 | 163 | if (!$user->rights->societe->client->voir && !$socid) { |
| 164 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 164 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 165 | 165 | } |
| 166 | 166 | $sql .= " WHERE p.fk_statut = 0"; |
| 167 | 167 | $sql .= " AND p.fk_soc = s.rowid"; |
| 168 | - $sql .= " AND p.entity IN (" . getEntity('propal') . ")"; |
|
| 168 | + $sql .= " AND p.entity IN (".getEntity('propal').")"; |
|
| 169 | 169 | if (!$user->rights->societe->client->voir && !$socid) { |
| 170 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 170 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 171 | 171 | } |
| 172 | 172 | if ($socid) { |
| 173 | - $sql .= " AND s.rowid = " . $socid; |
|
| 173 | + $sql .= " AND s.rowid = ".$socid; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $resql = $db->query($sql); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | print '<div class="div-table-responsive-no-min">'; |
| 182 | 182 | print '<table class="noborder" width="100%">'; |
| 183 | 183 | print '<tr class="liste_titre">'; |
| 184 | - print '<th colspan="3">' . $langs->trans("ProposalsDraft") . ($num ? ' <span class="badge">' . $num . '</span>' : '') . '</th></tr>'; |
|
| 184 | + print '<th colspan="3">'.$langs->trans("ProposalsDraft").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>'; |
|
| 185 | 185 | |
| 186 | 186 | if ($num > 0) { |
| 187 | 187 | $i = 0; |
@@ -206,17 +206,17 @@ discard block |
||
| 206 | 206 | $companystatic->canvas = $obj->canvas; |
| 207 | 207 | print $companystatic->getNomUrl(1, 'customer', 16); |
| 208 | 208 | print '</td>'; |
| 209 | - print '<td align="right" class="nowrap">' . price($obj->total_ht) . '</td></tr>'; |
|
| 209 | + print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>'; |
|
| 210 | 210 | $i++; |
| 211 | 211 | $total += $obj->total_ht; |
| 212 | 212 | } |
| 213 | 213 | if ($total > 0) { |
| 214 | 214 | |
| 215 | - print '<tr class="liste_total"><td>' . $langs->trans("Total") . '</td><td colspan="2" align="right">' . price($total) . "</td></tr>"; |
|
| 215 | + print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
|
| 216 | 216 | } |
| 217 | 217 | } else { |
| 218 | 218 | |
| 219 | - print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs->trans("NoProposal") . '</td></tr>'; |
|
| 219 | + print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>'; |
|
| 220 | 220 | } |
| 221 | 221 | print "</table></div><br>"; |
| 222 | 222 | |
@@ -236,19 +236,19 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; |
| 238 | 238 | $sql .= ", s.code_client"; |
| 239 | - $sql .= " FROM " . MAIN_DB_PREFIX . "supplier_proposal as p"; |
|
| 240 | - $sql .= ", " . MAIN_DB_PREFIX . "societe as s"; |
|
| 239 | + $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; |
|
| 240 | + $sql .= ", ".MAIN_DB_PREFIX."societe as s"; |
|
| 241 | 241 | if (!$user->rights->societe->client->voir && !$socid) { |
| 242 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 242 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 243 | 243 | } |
| 244 | 244 | $sql .= " WHERE p.fk_statut = 0"; |
| 245 | 245 | $sql .= " AND p.fk_soc = s.rowid"; |
| 246 | - $sql .= " AND p.entity IN (" . getEntity('supplier_proposal') . ")"; |
|
| 246 | + $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")"; |
|
| 247 | 247 | if (!$user->rights->societe->client->voir && !$socid) { |
| 248 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 248 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 249 | 249 | } |
| 250 | 250 | if ($socid) { |
| 251 | - $sql .= " AND s.rowid = " . $socid; |
|
| 251 | + $sql .= " AND s.rowid = ".$socid; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $resql = $db->query($sql); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | print '<div class="div-table-responsive-no-min">'; |
| 260 | 260 | print '<table class="noborder" width="100%">'; |
| 261 | 261 | print '<tr class="liste_titre">'; |
| 262 | - print '<th colspan="3">' . $langs->trans("SupplierProposalsDraft") . ($num ? ' <span class="badge">' . $num . '</span>' : '') . '</th></tr>'; |
|
| 262 | + print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>'; |
|
| 263 | 263 | |
| 264 | 264 | if ($num > 0) { |
| 265 | 265 | $i = 0; |
@@ -283,15 +283,15 @@ discard block |
||
| 283 | 283 | $companystatic->canvas = $obj->canvas; |
| 284 | 284 | print $companystatic->getNomUrl(1, 'supplier', 16); |
| 285 | 285 | print '</td>'; |
| 286 | - print '<td align="right" class="nowrap">' . price($obj->total_ht) . '</td></tr>'; |
|
| 286 | + print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>'; |
|
| 287 | 287 | $i++; |
| 288 | 288 | $total += $obj->total_ht; |
| 289 | 289 | } |
| 290 | 290 | if ($total > 0) { |
| 291 | - print '<tr class="liste_total"><td>' . $langs->trans("Total") . '</td><td colspan="2" align="right">' . price($total) . "</td></tr>"; |
|
| 291 | + print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
|
| 292 | 292 | } |
| 293 | 293 | } else { |
| 294 | - print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs->trans("NoProposal") . '</td></tr>'; |
|
| 294 | + print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>'; |
|
| 295 | 295 | } |
| 296 | 296 | print "</table></div><br>"; |
| 297 | 297 | |
@@ -310,19 +310,19 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; |
| 312 | 312 | $sql .= ", s.code_client"; |
| 313 | - $sql .= " FROM " . MAIN_DB_PREFIX . "commande as c"; |
|
| 314 | - $sql .= ", " . MAIN_DB_PREFIX . "societe as s"; |
|
| 313 | + $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; |
|
| 314 | + $sql .= ", ".MAIN_DB_PREFIX."societe as s"; |
|
| 315 | 315 | if (!$user->rights->societe->client->voir && !$socid) { |
| 316 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 316 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 317 | 317 | } |
| 318 | 318 | $sql .= " WHERE c.fk_soc = s.rowid"; |
| 319 | 319 | $sql .= " AND c.fk_statut = 0"; |
| 320 | - $sql .= " AND c.entity IN (" . getEntity('commande') . ")"; |
|
| 320 | + $sql .= " AND c.entity IN (".getEntity('commande').")"; |
|
| 321 | 321 | if (!$user->rights->societe->client->voir && !$socid) { |
| 322 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 322 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 323 | 323 | } |
| 324 | 324 | if ($socid) { |
| 325 | - $sql .= " AND c.fk_soc = " . $socid; |
|
| 325 | + $sql .= " AND c.fk_soc = ".$socid; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | $resql = $db->query($sql); |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | print '<div class="div-table-responsive-no-min">'; |
| 334 | 334 | print '<table class="noborder" width="100%">'; |
| 335 | 335 | print '<tr class="liste_titre">'; |
| 336 | - print '<th colspan="3">' . $langs->trans("DraftOrders") . ($num ? ' <span class="badge">' . $num . '</span>' : '') . '</th></tr>'; |
|
| 336 | + print '<th colspan="3">'.$langs->trans("DraftOrders").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>'; |
|
| 337 | 337 | |
| 338 | 338 | if ($num > 0) { |
| 339 | 339 | $i = 0; |
@@ -359,20 +359,20 @@ discard block |
||
| 359 | 359 | print $companystatic->getNomUrl(1, 'customer', 16); |
| 360 | 360 | print '</td>'; |
| 361 | 361 | if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { |
| 362 | - print '<td align="right" class="nowrap">' . price($obj->total_ht) . '</td></tr>'; |
|
| 362 | + print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>'; |
|
| 363 | 363 | } else { |
| 364 | - print '<td align="right" class="nowrap">' . price($obj->total_ttc) . '</td></tr>'; |
|
| 364 | + print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>'; |
|
| 365 | 365 | } |
| 366 | 366 | $i++; |
| 367 | 367 | $total += $obj->total_ttc; |
| 368 | 368 | } |
| 369 | 369 | if ($total > 0) { |
| 370 | 370 | |
| 371 | - print '<tr class="liste_total"><td>' . $langs->trans("Total") . '</td><td colspan="2" align="right">' . price($total) . "</td></tr>"; |
|
| 371 | + print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
|
| 372 | 372 | } |
| 373 | 373 | } else { |
| 374 | 374 | |
| 375 | - print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs->trans("NoOrder") . '</td></tr>'; |
|
| 375 | + print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>'; |
|
| 376 | 376 | } |
| 377 | 377 | print "</table>"; |
| 378 | 378 | print "</div><br>"; |
@@ -393,19 +393,19 @@ discard block |
||
| 393 | 393 | $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; |
| 394 | 394 | $sql .= ", s.code_client"; |
| 395 | 395 | $sql .= ", s.code_fournisseur"; |
| 396 | - $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseur as cf"; |
|
| 397 | - $sql .= ", " . MAIN_DB_PREFIX . "societe as s"; |
|
| 396 | + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; |
|
| 397 | + $sql .= ", ".MAIN_DB_PREFIX."societe as s"; |
|
| 398 | 398 | if (!$user->rights->societe->client->voir && !$socid) { |
| 399 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 399 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 400 | 400 | } |
| 401 | 401 | $sql .= " WHERE cf.fk_soc = s.rowid"; |
| 402 | 402 | $sql .= " AND cf.fk_statut = 0"; |
| 403 | - $sql .= " AND cf.entity IN (" . getEntity('supplier_order') . ")"; |
|
| 403 | + $sql .= " AND cf.entity IN (".getEntity('supplier_order').")"; |
|
| 404 | 404 | if (!$user->rights->societe->client->voir && !$socid) { |
| 405 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 405 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 406 | 406 | } |
| 407 | 407 | if ($socid) { |
| 408 | - $sql .= " AND cf.fk_soc = " . $socid; |
|
| 408 | + $sql .= " AND cf.fk_soc = ".$socid; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | $resql = $db->query($sql); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | print '<div class="div-table-responsive-no-min">'; |
| 417 | 417 | print '<table class="noborder" width="100%">'; |
| 418 | 418 | print '<tr class="liste_titre">'; |
| 419 | - print '<th colspan="3">' . $langs->trans("DraftSuppliersOrders") . ($num ? ' <span class="badge">' . $num . '</span>' : '') . '</th></tr>'; |
|
| 419 | + print '<th colspan="3">'.$langs->trans("DraftSuppliersOrders").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>'; |
|
| 420 | 420 | |
| 421 | 421 | if ($num > 0) { |
| 422 | 422 | $i = 0; |
@@ -442,20 +442,20 @@ discard block |
||
| 442 | 442 | print $companystatic->getNomUrl(1, 'supplier', 16); |
| 443 | 443 | print '</td>'; |
| 444 | 444 | if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { |
| 445 | - print '<td align="right" class="nowrap">' . price($obj->total_ht) . '</td></tr>'; |
|
| 445 | + print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>'; |
|
| 446 | 446 | } else { |
| 447 | - print '<td align="right" class="nowrap">' . price($obj->total_ttc) . '</td></tr>'; |
|
| 447 | + print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>'; |
|
| 448 | 448 | } |
| 449 | 449 | $i++; |
| 450 | 450 | $total += $obj->total_ttc; |
| 451 | 451 | } |
| 452 | 452 | if ($total > 0) { |
| 453 | 453 | |
| 454 | - print '<tr class="liste_total"><td>' . $langs->trans("Total") . '</td><td colspan="2" align="right">' . price($total) . "</td></tr>"; |
|
| 454 | + print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>"; |
|
| 455 | 455 | } |
| 456 | 456 | } else { |
| 457 | 457 | |
| 458 | - print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs->trans("NoSupplierOrder") . '</td></tr>'; |
|
| 458 | + print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</td></tr>'; |
|
| 459 | 459 | } |
| 460 | 460 | print "</table>"; |
| 461 | 461 | print "</div><br>"; |
@@ -482,14 +482,14 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas"; |
| 484 | 484 | $sql .= ", s.code_client"; |
| 485 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; |
|
| 485 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
| 486 | 486 | if (!$user->rights->societe->client->voir && !$socid) { |
| 487 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 487 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 488 | 488 | } |
| 489 | 489 | $sql .= " WHERE s.client IN (1, 2, 3)"; |
| 490 | - $sql .= " AND s.entity IN (" . getEntity($companystatic->element) . ")"; |
|
| 490 | + $sql .= " AND s.entity IN (".getEntity($companystatic->element).")"; |
|
| 491 | 491 | if (!$user->rights->societe->client->voir && !$socid) { |
| 492 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 492 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 493 | 493 | } |
| 494 | 494 | if ($socid) { |
| 495 | 495 | $sql .= " AND s.rowid = $socid"; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | print $langs->trans("BoxTitleLastModifiedCustomers", $max); |
| 515 | 515 | } |
| 516 | 516 | print '</th>'; |
| 517 | - print '<th align="right"><a class="commonlink" href="' . DOL_URL_ROOT . '/societe/list.php?type=p,c">' . $langs->trans("FullList") . '</a></th>'; |
|
| 517 | + print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=p,c">'.$langs->trans("FullList").'</a></th>'; |
|
| 518 | 518 | print '</tr>'; |
| 519 | 519 | if ($num) { |
| 520 | 520 | while ($i < $num) { |
@@ -526,18 +526,18 @@ discard block |
||
| 526 | 526 | $companystatic->code_fournisseur = $objp->code_fournisseur; |
| 527 | 527 | $companystatic->canvas = $objp->canvas; |
| 528 | 528 | print '<tr class="oddeven">'; |
| 529 | - print '<td class="nowrap">' . $companystatic->getNomUrl(1, 'customer', 48) . '</td>'; |
|
| 529 | + print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>'; |
|
| 530 | 530 | print '<td align="right" nowrap>'; |
| 531 | 531 | print $companystatic->getLibCustProspStatut(); |
| 532 | 532 | print "</td>"; |
| 533 | - print '<td align="right" nowrap>' . dol_print_date($db->jdate($objp->tms), 'day') . "</td>"; |
|
| 533 | + print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms), 'day')."</td>"; |
|
| 534 | 534 | print '</tr>'; |
| 535 | 535 | $i++; |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | $db->free($resql); |
| 539 | 539 | } else { |
| 540 | - print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs->trans("None") . '</td></tr>'; |
|
| 540 | + print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; |
|
| 541 | 541 | } |
| 542 | 542 | print "</table>"; |
| 543 | 543 | print "</div><br>"; |
@@ -550,17 +550,17 @@ discard block |
||
| 550 | 550 | |
| 551 | 551 | $sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm"; |
| 552 | 552 | $sql .= ", s.code_fournisseur"; |
| 553 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; |
|
| 553 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
| 554 | 554 | if (!$user->rights->societe->client->voir && !$user->societe_id) { |
| 555 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 555 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 556 | 556 | } |
| 557 | 557 | $sql .= " WHERE s.fournisseur = 1"; |
| 558 | - $sql .= " AND s.entity IN (" . getEntity($companystatic->element) . ")"; |
|
| 558 | + $sql .= " AND s.entity IN (".getEntity($companystatic->element).")"; |
|
| 559 | 559 | if (!$user->rights->societe->client->voir && !$user->societe_id) { |
| 560 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 560 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 561 | 561 | } |
| 562 | 562 | if ($socid) { |
| 563 | - $sql .= " AND s.rowid = " . $socid; |
|
| 563 | + $sql .= " AND s.rowid = ".$socid; |
|
| 564 | 564 | } |
| 565 | 565 | $sql .= " ORDER BY s.datec DESC"; |
| 566 | 566 | $sql .= $db->plimit($max, 0); |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | print '<div class="div-table-responsive-no-min">'; |
| 574 | 574 | print '<table class="noborder" width="100%">'; |
| 575 | 575 | print '<tr class="liste_titre">'; |
| 576 | - print '<th>' . $langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)) . '</th>'; |
|
| 577 | - print '<th align="right"><a class="commonlink" href="' . DOL_URL_ROOT . '/societe/list.php?type=f">' . $langs->trans("FullList") . '</a></th>'; |
|
| 576 | + print '<th>'.$langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)).'</th>'; |
|
| 577 | + print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("FullList").'</a></th>'; |
|
| 578 | 578 | print '</tr>'; |
| 579 | 579 | if ($num) { |
| 580 | 580 | while ($i < $num && $i < $max) { |
@@ -585,14 +585,14 @@ discard block |
||
| 585 | 585 | $companystatic->code_fournisseur = $objp->code_fournisseur; |
| 586 | 586 | $companystatic->canvas = $objp->canvas; |
| 587 | 587 | print '<tr class="oddeven">'; |
| 588 | - print '<td class="nowrap">' . $companystatic->getNomUrl(1, 'supplier', 44) . '</td>'; |
|
| 589 | - print '<td align="right">' . dol_print_date($db->jdate($objp->dm), 'day') . '</td>'; |
|
| 588 | + print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>'; |
|
| 589 | + print '<td align="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>'; |
|
| 590 | 590 | print '</tr>'; |
| 591 | 591 | |
| 592 | 592 | $i++; |
| 593 | 593 | } |
| 594 | 594 | } else { |
| 595 | - print '<tr class="oddeven"><td colspan="2" class="opacitymedium">' . $langs->trans("None") . '</td></tr>'; |
|
| 595 | + print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; |
|
| 596 | 596 | } |
| 597 | 597 | print '</table>'; |
| 598 | 598 | print '</div><br>'; |
@@ -625,20 +625,20 @@ discard block |
||
| 625 | 625 | $sql = "SELECT s.nom as name, s.rowid, s.canvas, "; |
| 626 | 626 | $sql .= ", s.code_client"; |
| 627 | 627 | $sql .= " c.statut, c.rowid as contratid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo"; |
| 628 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; |
|
| 629 | - $sql .= ", " . MAIN_DB_PREFIX . "contrat as c"; |
|
| 630 | - $sql .= ", " . MAIN_DB_PREFIX . "product as p"; |
|
| 628 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
| 629 | + $sql .= ", ".MAIN_DB_PREFIX."contrat as c"; |
|
| 630 | + $sql .= ", ".MAIN_DB_PREFIX."product as p"; |
|
| 631 | 631 | if (!$user->rights->societe->client->voir && !$socid) { |
| 632 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 632 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 633 | 633 | } |
| 634 | 634 | $sql .= " WHERE c.fk_soc = s.rowid"; |
| 635 | - $sql .= " AND c.entity IN (" . getEntity('contract') . ")"; |
|
| 635 | + $sql .= " AND c.entity IN (".getEntity('contract').")"; |
|
| 636 | 636 | $sql .= " AND c.fk_product = p.rowid"; |
| 637 | 637 | if (!$user->rights->societe->client->voir && !$socid) { |
| 638 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 638 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 639 | 639 | } |
| 640 | 640 | if ($socid) { |
| 641 | - $sql .= " AND s.rowid = " . $socid; |
|
| 641 | + $sql .= " AND s.rowid = ".$socid; |
|
| 642 | 642 | } |
| 643 | 643 | $sql .= " ORDER BY c.tms DESC"; |
| 644 | 644 | $sql .= $db->plimit(5, 0); |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | if ($num > 0) { |
| 651 | 651 | print '<div class="div-table-responsive-no-min">'; |
| 652 | 652 | print '<table class="noborder" width="100%">'; |
| 653 | - print '<tr class="liste_titre"><th colspan="3">' . $langs->trans("LastContracts", 5) . '</th></tr>'; |
|
| 653 | + print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("LastContracts", 5).'</th></tr>'; |
|
| 654 | 654 | $i = 0; |
| 655 | 655 | |
| 656 | 656 | $staticcontrat = new Contrat($db); |
@@ -665,8 +665,8 @@ discard block |
||
| 665 | 665 | $companystatic->code_fournisseur = $objp->code_fournisseur; |
| 666 | 666 | $companystatic->canvas = $objp->canvas; |
| 667 | 667 | print $companystatic->getNomUrl(1, 'customer', 44); |
| 668 | - print '</td>' . "\n"; |
|
| 669 | - print "<td align=\"right\">" . $staticcontrat->LibStatut($obj->statut, 3) . "</td></tr>\n"; |
|
| 668 | + print '</td>'."\n"; |
|
| 669 | + print "<td align=\"right\">".$staticcontrat->LibStatut($obj->statut, 3)."</td></tr>\n"; |
|
| 670 | 670 | |
| 671 | 671 | $i++; |
| 672 | 672 | } |
@@ -686,19 +686,19 @@ discard block |
||
| 686 | 686 | |
| 687 | 687 | $sql = "SELECT s.nom as name, s.rowid, s.code_client"; |
| 688 | 688 | $sql .= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; |
| 689 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; |
|
| 690 | - $sql .= ", " . MAIN_DB_PREFIX . "propal as p"; |
|
| 689 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
| 690 | + $sql .= ", ".MAIN_DB_PREFIX."propal as p"; |
|
| 691 | 691 | if (!$user->rights->societe->client->voir && !$socid) { |
| 692 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 692 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 693 | 693 | } |
| 694 | 694 | $sql .= " WHERE p.fk_soc = s.rowid"; |
| 695 | - $sql .= " AND p.entity IN (" . getEntity('propal') . ")"; |
|
| 695 | + $sql .= " AND p.entity IN (".getEntity('propal').")"; |
|
| 696 | 696 | $sql .= " AND p.fk_statut = 1"; |
| 697 | 697 | if (!$user->rights->societe->client->voir && !$socid) { |
| 698 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 698 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 699 | 699 | } |
| 700 | 700 | if ($socid) { |
| 701 | - $sql .= " AND s.rowid = " . $socid; |
|
| 701 | + $sql .= " AND s.rowid = ".$socid; |
|
| 702 | 702 | } |
| 703 | 703 | $sql .= " ORDER BY p.rowid DESC"; |
| 704 | 704 | |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | if ($num > 0) { |
| 711 | 711 | print '<div class="div-table-responsive-no-min">'; |
| 712 | 712 | print '<table class="noborder" width="100%">'; |
| 713 | - print '<tr class="liste_titre"><th colspan="5">' . $langs->trans("ProposalsOpened") . ' <a href="' . DOL_URL_ROOT . '/comm/propal/list.php?viewstatut=1"><span class="badge">' . $num . '</span></th></tr>'; |
|
| 713 | + print '<tr class="liste_titre"><th colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1"><span class="badge">'.$num.'</span></th></tr>'; |
|
| 714 | 714 | |
| 715 | 715 | $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); |
| 716 | 716 | while ($i < $nbofloop) { |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | print '</td>'; |
| 740 | 740 | print '<td width="16" align="center" class="nobordernopadding">'; |
| 741 | 741 | $filename = dol_sanitizeFileName($obj->ref); |
| 742 | - $filedir = $conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); |
|
| 743 | - $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $obj->propalid; |
|
| 742 | + $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); |
|
| 743 | + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; |
|
| 744 | 744 | print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); |
| 745 | 745 | print '</td></tr></table>'; |
| 746 | 746 | |
@@ -756,21 +756,21 @@ discard block |
||
| 756 | 756 | print $companystatic->getNomUrl(1, 'customer', 44); |
| 757 | 757 | print '</td>'; |
| 758 | 758 | print '<td align="right">'; |
| 759 | - print dol_print_date($db->jdate($obj->dp), 'day') . '</td>' . "\n"; |
|
| 759 | + print dol_print_date($db->jdate($obj->dp), 'day').'</td>'."\n"; |
|
| 760 | 760 | if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { |
| 761 | - print '<td align="right">' . price($obj->total_ht) . '</td>'; |
|
| 761 | + print '<td align="right">'.price($obj->total_ht).'</td>'; |
|
| 762 | 762 | } else { |
| 763 | - print '<td align="right">' . price($obj->total_ttc) . '</td>'; |
|
| 763 | + print '<td align="right">'.price($obj->total_ttc).'</td>'; |
|
| 764 | 764 | } |
| 765 | - print '<td align="center" width="14">' . $propalstatic->LibStatut($obj->fk_statut, 3) . '</td>' . "\n"; |
|
| 766 | - print '</tr>' . "\n"; |
|
| 765 | + print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>'."\n"; |
|
| 766 | + print '</tr>'."\n"; |
|
| 767 | 767 | $i++; |
| 768 | 768 | $total += $obj->total_ttc; |
| 769 | 769 | } |
| 770 | 770 | if ($num > $nbofloop) { |
| 771 | - print '<tr class="liste_total"><td colspan="5">' . $langs->trans("XMoreLines", ($num - $nbofloop)) . "</td></tr>"; |
|
| 771 | + print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>"; |
|
| 772 | 772 | } else if ($total > 0) { |
| 773 | - print '<tr class="liste_total"><td colspan="3">' . $langs->trans("Total") . "</td><td align=\"right\">" . price($total) . "</td><td> </td></tr>"; |
|
| 773 | + print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>"; |
|
| 774 | 774 | } |
| 775 | 775 | print "</table>"; |
| 776 | 776 | print "</div><br>"; |
@@ -788,19 +788,19 @@ discard block |
||
| 788 | 788 | |
| 789 | 789 | $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; |
| 790 | 790 | $sql .= ", s.code_client"; |
| 791 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; |
|
| 792 | - $sql .= ", " . MAIN_DB_PREFIX . "commande as c"; |
|
| 791 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
| 792 | + $sql .= ", ".MAIN_DB_PREFIX."commande as c"; |
|
| 793 | 793 | if (!$user->rights->societe->client->voir && !$socid) { |
| 794 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
| 794 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
| 795 | 795 | } |
| 796 | 796 | $sql .= " WHERE c.fk_soc = s.rowid"; |
| 797 | - $sql .= " AND c.entity IN (" . getEntity('commande') . ")"; |
|
| 798 | - $sql .= " AND (c.fk_statut = " . Commande::STATUS_VALIDATED . " or c.fk_statut = " . Commande::STATUS_SHIPMENTONPROCESS . ")"; |
|
| 797 | + $sql .= " AND c.entity IN (".getEntity('commande').")"; |
|
| 798 | + $sql .= " AND (c.fk_statut = ".Commande::STATUS_VALIDATED." or c.fk_statut = ".Commande::STATUS_SHIPMENTONPROCESS.")"; |
|
| 799 | 799 | if (!$user->rights->societe->client->voir && !$socid) { |
| 800 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
| 800 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
| 801 | 801 | } |
| 802 | 802 | if ($socid) { |
| 803 | - $sql .= " AND s.rowid = " . $socid; |
|
| 803 | + $sql .= " AND s.rowid = ".$socid; |
|
| 804 | 804 | } |
| 805 | 805 | $sql .= " ORDER BY c.rowid DESC"; |
| 806 | 806 | |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | if ($num > 0) { |
| 813 | 813 | print '<div class="div-table-responsive-no-min">'; |
| 814 | 814 | print '<table class="noborder" width="100%">'; |
| 815 | - print '<tr class="liste_titre"><th class="liste_titre" colspan="5">' . $langs->trans("OrdersOpened") . ' <a href="' . DOL_URL_ROOT . '/commande/list.php?viewstatut=1"><span class="badge">' . $num . '</span></th></tr>'; |
|
| 815 | + print '<tr class="liste_titre"><th class="liste_titre" colspan="5">'.$langs->trans("OrdersOpened").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></th></tr>'; |
|
| 816 | 816 | |
| 817 | 817 | $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); |
| 818 | 818 | while ($i < $nbofloop) { |
@@ -839,8 +839,8 @@ discard block |
||
| 839 | 839 | print '</td>'; |
| 840 | 840 | print '<td width="16" align="center" class="nobordernopadding">'; |
| 841 | 841 | $filename = dol_sanitizeFileName($obj->ref); |
| 842 | - $filedir = $conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); |
|
| 843 | - $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $obj->propalid; |
|
| 842 | + $filedir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); |
|
| 843 | + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; |
|
| 844 | 844 | print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir); |
| 845 | 845 | print '</td></tr></table>'; |
| 846 | 846 | |
@@ -856,21 +856,21 @@ discard block |
||
| 856 | 856 | print $companystatic->getNomUrl(1, 'customer', 44); |
| 857 | 857 | print '</td>'; |
| 858 | 858 | print '<td align="right">'; |
| 859 | - print dol_print_date($db->jdate($obj->dp), 'day') . '</td>' . "\n"; |
|
| 859 | + print dol_print_date($db->jdate($obj->dp), 'day').'</td>'."\n"; |
|
| 860 | 860 | if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { |
| 861 | - print '<td align="right">' . price($obj->total_ht) . '</td>'; |
|
| 861 | + print '<td align="right">'.price($obj->total_ht).'</td>'; |
|
| 862 | 862 | } else { |
| 863 | - print '<td align="right">' . price($obj->total_ttc) . '</td>'; |
|
| 863 | + print '<td align="right">'.price($obj->total_ttc).'</td>'; |
|
| 864 | 864 | } |
| 865 | - print '<td align="center" width="14">' . $orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3) . '</td>' . "\n"; |
|
| 866 | - print '</tr>' . "\n"; |
|
| 865 | + print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>'."\n"; |
|
| 866 | + print '</tr>'."\n"; |
|
| 867 | 867 | $i++; |
| 868 | 868 | $total += $obj->total_ttc; |
| 869 | 869 | } |
| 870 | 870 | if ($num > $nbofloop) { |
| 871 | - print '<tr class="liste_total"><td colspan="5">' . $langs->trans("XMoreLines", ($num - $nbofloop)) . "</td></tr>"; |
|
| 871 | + print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>"; |
|
| 872 | 872 | } else if ($total > 0) { |
| 873 | - print '<tr class="liste_total"><td colspan="3">' . $langs->trans("Total") . "</td><td align=\"right\">" . price($total) . "</td><td> </td></tr>"; |
|
| 873 | + print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>"; |
|
| 874 | 874 | } |
| 875 | 875 | print "</table>"; |
| 876 | 876 | print "</div><br>"; |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | define('NOREDIRECTBYMAINTOLOGIN', 1);
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 38 | -require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
| 39 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/agenda.lib.php'; |
|
| 41 | -include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 42 | -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 36 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 38 | +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
| 39 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; |
|
| 41 | +include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 42 | +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 43 | 43 | |
| 44 | 44 | // Load translation files required by the page |
| 45 | 45 | $langs->loadLangs(array("users", "companies", "agenda", "commercial"));
|
| 46 | 46 | |
| 47 | 47 | $action = Request::getAlpha('action');
|
| 48 | -$contextpage = Request::getAz('contextpage', 'aZ') ?? 'actioncommlist'; // To manage different context of search
|
|
| 48 | +$contextpage = Request::getAz('contextpage', 'aZ') ?? 'actioncommlist'; // To manage different context of search
|
|
| 49 | 49 | $resourceid = Request::getNumber("search_resourceid") ?? Request::getNumber("resourceid");
|
| 50 | 50 | $pid = Request::getNumber("search_projectid", [INPUT_POST, INPUT_GET]) ?? Request::getNumber("projectid", [INPUT_POST, INPUT_GET]);
|
| 51 | 51 | $status = Request::getAlpha("search_status") ?? Request::getAlpha("status");
|
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
| 155 | 155 | foreach ($extrafields->attribute_label as $key => $val) {
|
| 156 | 156 | if (!empty($extrafields->attribute_list[$key])) |
| 157 | - $arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], 'checked' => $extrafields->attribute_list[$key], 'position' => $extrafields->attribute_pos[$key], 'enabled' => $extrafields->attribute_perms[$key]);
|
|
| 157 | + $arrayfields["ef.".$key] = array('label' => $extrafields->attribute_label[$key], 'checked' => $extrafields->attribute_list[$key], 'position' => $extrafields->attribute_pos[$key], 'enabled' => $extrafields->attribute_perms[$key]);
|
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
@@ -167,21 +167,21 @@ discard block |
||
| 167 | 167 | $param = ''; |
| 168 | 168 | if (is_array($_POST)) {
|
| 169 | 169 | foreach ($_POST as $key => $val) {
|
| 170 | - $param .= '&' . $key . '=' . urlencode($val); |
|
| 170 | + $param .= '&'.$key.'='.urlencode($val); |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | //print $param; |
| 174 | - header("Location: " . DOL_URL_ROOT . '/comm/action/index.php?' . $param);
|
|
| 174 | + header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
|
|
| 175 | 175 | exit; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | $parameters = array('id' => $socid);
|
| 179 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 179 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 180 | 180 | if ($reshook < 0) |
| 181 | 181 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 182 | 182 | |
| 183 | 183 | // Selection of new fields |
| 184 | -include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
|
| 184 | +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
| 185 | 185 | // Purge search criteria |
| 186 | 186 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
| 187 | 187 | //$actioncode=''; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | $nav = ''; |
| 206 | 206 | $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); |
| 207 | -$nav .= ' <input type="submit" name="submitdateselect" class="button" value="' . $langs->trans("Refresh") . '">';
|
|
| 207 | +$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
|
| 208 | 208 | |
| 209 | 209 | $now = dol_now(); |
| 210 | 210 | |
@@ -216,54 +216,54 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | $param = ''; |
| 218 | 218 | if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) |
| 219 | - $param .= '&contextpage=' . urlencode($contextpage); |
|
| 219 | + $param .= '&contextpage='.urlencode($contextpage); |
|
| 220 | 220 | if ($limit > 0 && $limit != $conf->liste_limit) |
| 221 | - $param .= '&limit=' . urlencode($limit); |
|
| 221 | + $param .= '&limit='.urlencode($limit); |
|
| 222 | 222 | if ($actioncode != '') {
|
| 223 | 223 | if (is_array($actioncode)) {
|
| 224 | 224 | foreach ($actioncode as $str_action) |
| 225 | - $param .= "&search_actioncode[]=" . urlencode($str_action); |
|
| 225 | + $param .= "&search_actioncode[]=".urlencode($str_action); |
|
| 226 | 226 | } else |
| 227 | - $param .= "&search_actioncode=" . urlencode($actioncode); |
|
| 227 | + $param .= "&search_actioncode=".urlencode($actioncode); |
|
| 228 | 228 | } |
| 229 | 229 | if ($resourceid > 0) |
| 230 | - $param .= "&search_resourceid=" . urlencode($resourceid); |
|
| 230 | + $param .= "&search_resourceid=".urlencode($resourceid); |
|
| 231 | 231 | if ($status != '' && $status > -1) |
| 232 | - $param .= "&search_status=" . urlencode($status); |
|
| 232 | + $param .= "&search_status=".urlencode($status); |
|
| 233 | 233 | if ($filter) |
| 234 | - $param .= "&search_filter=" . urlencode($filter); |
|
| 234 | + $param .= "&search_filter=".urlencode($filter); |
|
| 235 | 235 | if ($filtert) |
| 236 | - $param .= "&search_filtert=" . urlencode($filtert); |
|
| 236 | + $param .= "&search_filtert=".urlencode($filtert); |
|
| 237 | 237 | if ($socid) |
| 238 | - $param .= "&search_socid=" . urlencode($socid); |
|
| 238 | + $param .= "&search_socid=".urlencode($socid); |
|
| 239 | 239 | if ($showbirthday) |
| 240 | 240 | $param .= "&search_showbirthday=1"; |
| 241 | 241 | if ($pid) |
| 242 | - $param .= "&search_projectid=" . urlencode($pid); |
|
| 242 | + $param .= "&search_projectid=".urlencode($pid); |
|
| 243 | 243 | if ($type) |
| 244 | - $param .= "&search_type=" . urlencode($type); |
|
| 244 | + $param .= "&search_type=".urlencode($type); |
|
| 245 | 245 | if ($usergroup) |
| 246 | - $param .= "&search_usergroup=" . urlencode($usergroup); |
|
| 246 | + $param .= "&search_usergroup=".urlencode($usergroup); |
|
| 247 | 247 | if ($search_id != '') |
| 248 | - $param .= '&search_title=' . urlencode($search_id); |
|
| 248 | + $param .= '&search_title='.urlencode($search_id); |
|
| 249 | 249 | if ($search_title != '') |
| 250 | - $param .= '&search_title=' . urlencode($search_title); |
|
| 250 | + $param .= '&search_title='.urlencode($search_title); |
|
| 251 | 251 | if (GETPOST('datestartday', 'int'))
|
| 252 | - $param .= '&datestartday=' . GETPOST('datestartday', 'int');
|
|
| 252 | + $param .= '&datestartday='.GETPOST('datestartday', 'int');
|
|
| 253 | 253 | if (GETPOST('datestartmonth', 'int'))
|
| 254 | - $param .= '&datestartmonth=' . GETPOST('datestartmonth', 'int');
|
|
| 254 | + $param .= '&datestartmonth='.GETPOST('datestartmonth', 'int');
|
|
| 255 | 255 | if (GETPOST('datestartyear', 'int'))
|
| 256 | - $param .= '&datestartyear=' . GETPOST('datestartyear', 'int');
|
|
| 256 | + $param .= '&datestartyear='.GETPOST('datestartyear', 'int');
|
|
| 257 | 257 | if (GETPOST('dateendday', 'int'))
|
| 258 | - $param .= '&dateendday=' . GETPOST('dateendday', 'int');
|
|
| 258 | + $param .= '&dateendday='.GETPOST('dateendday', 'int');
|
|
| 259 | 259 | if (GETPOST('dateendmonth', 'int'))
|
| 260 | - $param .= '&dateendmonth=' . GETPOST('dateendmonth', 'int');
|
|
| 260 | + $param .= '&dateendmonth='.GETPOST('dateendmonth', 'int');
|
|
| 261 | 261 | if (GETPOST('dateendyear', 'int'))
|
| 262 | - $param .= '&dateendyear=' . GETPOST('dateendyear', 'int');
|
|
| 262 | + $param .= '&dateendyear='.GETPOST('dateendyear', 'int');
|
|
| 263 | 263 | if ($optioncss != '') |
| 264 | - $param .= '&optioncss=' . urlencode($optioncss); |
|
| 264 | + $param .= '&optioncss='.urlencode($optioncss); |
|
| 265 | 265 | // Add $param from extra fields |
| 266 | -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php'; |
|
| 266 | +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
|
| 267 | 267 | |
| 268 | 268 | $sql = "SELECT"; |
| 269 | 269 | if ($usergroup > 0) |
@@ -277,24 +277,24 @@ discard block |
||
| 277 | 277 | $sql .= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; |
| 278 | 278 | // Add fields from extrafields |
| 279 | 279 | foreach ($extrafields->attribute_label as $key => $val) |
| 280 | - $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : ''); |
|
| 281 | -$sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a"; |
|
| 282 | -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "actioncomm_extrafields as ef ON (a.id = ef.fk_object) "; |
|
| 280 | + $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
| 281 | +$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; |
|
| 282 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object) "; |
|
| 283 | 283 | if (!$user->rights->societe->client->voir && !$socid) |
| 284 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 285 | -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON a.fk_soc = s.rowid"; |
|
| 286 | -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sp ON a.fk_contact = sp.rowid"; |
|
| 287 | -$sql .= " ," . MAIN_DB_PREFIX . "c_actioncomm as c"; |
|
| 284 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 285 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
| 286 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; |
|
| 287 | +$sql .= " ,".MAIN_DB_PREFIX."c_actioncomm as c"; |
|
| 288 | 288 | // We must filter on resource table |
| 289 | 289 | if ($resourceid > 0) |
| 290 | - $sql .= ", " . MAIN_DB_PREFIX . "element_resources as r"; |
|
| 290 | + $sql .= ", ".MAIN_DB_PREFIX."element_resources as r"; |
|
| 291 | 291 | // We must filter on assignement table |
| 292 | 292 | if ($filtert > 0 || $usergroup > 0) |
| 293 | - $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 293 | + $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; |
|
| 294 | 294 | if ($usergroup > 0) |
| 295 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 295 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 296 | 296 | $sql .= " WHERE c.id = a.fk_action"; |
| 297 | -$sql .= ' AND a.entity IN (' . getEntity('agenda') . ')';
|
|
| 297 | +$sql .= ' AND a.entity IN ('.getEntity('agenda').')';
|
|
| 298 | 298 | // Condition on actioncode |
| 299 | 299 | if (!empty($actioncode)) {
|
| 300 | 300 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
@@ -316,26 +316,26 @@ discard block |
||
| 316 | 316 | $sql .= " AND c.type = 'systemauto'"; |
| 317 | 317 | else {
|
| 318 | 318 | if (is_array($actioncode)) {
|
| 319 | - $sql .= " AND c.code IN ('" . implode("','", $actioncode) . "')";
|
|
| 319 | + $sql .= " AND c.code IN ('".implode("','", $actioncode)."')";
|
|
| 320 | 320 | } else {
|
| 321 | - $sql .= " AND c.code IN ('" . implode("','", explode(',', $actioncode)) . "')";
|
|
| 321 | + $sql .= " AND c.code IN ('".implode("','", explode(',', $actioncode))."')";
|
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | if ($resourceid > 0) |
| 327 | - $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = " . $db->escape($resourceid); |
|
| 327 | + $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); |
|
| 328 | 328 | if ($pid) |
| 329 | - $sql .= " AND a.fk_project=" . $db->escape($pid); |
|
| 329 | + $sql .= " AND a.fk_project=".$db->escape($pid); |
|
| 330 | 330 | if (!$user->rights->societe->client->voir && !$socid) |
| 331 | - $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 331 | + $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")"; |
|
| 332 | 332 | if ($socid > 0) |
| 333 | - $sql .= " AND s.rowid = " . $socid; |
|
| 333 | + $sql .= " AND s.rowid = ".$socid; |
|
| 334 | 334 | // We must filter on assignement table |
| 335 | 335 | if ($filtert > 0 || $usergroup > 0) |
| 336 | 336 | $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
| 337 | 337 | if ($type) |
| 338 | - $sql .= " AND c.id = " . $type; |
|
| 338 | + $sql .= " AND c.id = ".$type; |
|
| 339 | 339 | if ($status == '0') {
|
| 340 | 340 | $sql .= " AND a.percent = 0"; |
| 341 | 341 | } |
@@ -362,21 +362,21 @@ discard block |
||
| 362 | 362 | if ($filtert > 0 || $usergroup > 0) {
|
| 363 | 363 | $sql .= " AND (";
|
| 364 | 364 | if ($filtert > 0) |
| 365 | - $sql .= "(ar.fk_element = " . $filtert . " OR (ar.fk_element IS NULL AND a.fk_user_action=" . $filtert . "))"; // The OR is for backward compatibility |
|
| 365 | + $sql .= "(ar.fk_element = ".$filtert." OR (ar.fk_element IS NULL AND a.fk_user_action=".$filtert."))"; // The OR is for backward compatibility |
|
| 366 | 366 | if ($usergroup > 0) |
| 367 | - $sql .= ($filtert > 0 ? " OR " : "") . " ugu.fk_usergroup = " . $usergroup; |
|
| 367 | + $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup; |
|
| 368 | 368 | $sql .= ")"; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case) |
| 372 | 372 | if ($dateselect > 0) |
| 373 | - $sql .= " AND ((a.datep2 >= '" . $db->idate($dateselect) . "' AND a.datep <= '" . $db->idate($dateselect + 3600 * 24 - 1) . "') OR (a.datep2 IS NULL AND a.datep > '" . $db->idate($dateselect - 3600) . "' AND a.datep <= '" . $db->idate($dateselect + 3600 * 24 - 1) . "'))"; |
|
| 373 | + $sql .= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect - 3600)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."'))"; |
|
| 374 | 374 | if ($datestart > 0) |
| 375 | - $sql .= " AND a.datep BETWEEN '" . $db->idate($datestart) . "' AND '" . $db->idate($datestart + 3600 * 24 - 1) . "'"; |
|
| 375 | + $sql .= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart + 3600 * 24 - 1)."'"; |
|
| 376 | 376 | if ($dateend > 0) |
| 377 | - $sql .= " AND a.datep2 BETWEEN '" . $db->idate($dateend) . "' AND '" . $db->idate($dateend + 3600 * 24 - 1) . "'"; |
|
| 377 | + $sql .= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend + 3600 * 24 - 1)."'"; |
|
| 378 | 378 | // Add where from extra fields |
| 379 | -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php'; |
|
| 379 | +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
|
| 380 | 380 | |
| 381 | 381 | $sql .= $db->order($sortfield, $sortorder); |
| 382 | 382 | |
@@ -402,30 +402,30 @@ discard block |
||
| 402 | 402 | $num = $db->num_rows($resql); |
| 403 | 403 | |
| 404 | 404 | // Local calendar |
| 405 | - $newtitle = '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda") . ' </div>';
|
|
| 405 | + $newtitle = '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' </div>';
|
|
| 406 | 406 | //$newtitle=$langs->trans($title); |
| 407 | 407 | |
| 408 | 408 | $tabactive = 'cardlist'; |
| 409 | 409 | |
| 410 | 410 | $head = calendars_prepare_head($param); |
| 411 | 411 | |
| 412 | - print '<form method="POST" id="searchFormList" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '">' . "\n"; |
|
| 412 | + print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n"; |
|
| 413 | 413 | |
| 414 | 414 | if ($optioncss != '') |
| 415 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 416 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 415 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 416 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 417 | 417 | print '<input type="hidden" name="action" value="list">'; |
| 418 | 418 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
| 419 | - print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
|
| 420 | - print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
|
| 421 | - print '<input type="hidden" name="page" value="' . $page . '">'; |
|
| 422 | - print '<input type="hidden" name="type" value="' . $type . '">'; |
|
| 419 | + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
|
| 420 | + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; |
|
| 421 | + print '<input type="hidden" name="page" value="'.$page.'">'; |
|
| 422 | + print '<input type="hidden" name="type" value="'.$type.'">'; |
|
| 423 | 423 | $nav = ''; |
| 424 | 424 | |
| 425 | 425 | //if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
| 426 | 426 | //if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">'; |
| 427 | 427 | if ($filter) |
| 428 | - $nav .= '<input type="hidden" name="search_filter" value="' . $filter . '">'; |
|
| 428 | + $nav .= '<input type="hidden" name="search_filter" value="'.$filter.'">'; |
|
| 429 | 429 | //if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; |
| 430 | 430 | //if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; |
| 431 | 431 | if ($showbirthday) |
@@ -471,16 +471,16 @@ discard block |
||
| 471 | 471 | if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
|
| 472 | 472 | $tmpforcreatebutton = dol_getdate(dol_now(), true); |
| 473 | 473 | |
| 474 | - $newparam .= '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $tmpforcreatebutton['year']; |
|
| 474 | + $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; |
|
| 475 | 475 | |
| 476 | 476 | //$param='month='.$monthshown.'&year='.$year; |
| 477 | 477 | $hourminsec = '100000'; |
| 478 | - $newcardbutton = '<a class="butActionNew" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&datep=' . sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']) . $hourminsec . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . ($newparam ? '?' . $newparam : '')) . '"><span class="valignmiddle">' . $langs->trans("AddAction") . '</span>';
|
|
| 478 | + $newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')).'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
|
|
| 479 | 479 | $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
| 480 | 480 | $newcardbutton .= '</a>'; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav . $newcardbutton, '', $limit); |
|
| 483 | + print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit); |
|
| 484 | 484 | |
| 485 | 485 | $moreforfilter = ''; |
| 486 | 486 | |
@@ -490,17 +490,17 @@ discard block |
||
| 490 | 490 | $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
| 491 | 491 | $i = 0; |
| 492 | 492 | print '<div class="div-table-responsive">'; |
| 493 | - print '<table class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; |
|
| 493 | + print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; |
|
| 494 | 494 | |
| 495 | 495 | print '<tr class="liste_titre_filter">'; |
| 496 | 496 | if (!empty($arrayfields['a.id']['checked'])) |
| 497 | - print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="' . $search_id . '"></td>'; |
|
| 497 | + print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>'; |
|
| 498 | 498 | if (!empty($arrayfields['owner']['checked'])) |
| 499 | 499 | print '<td class="liste_titre"></td>'; |
| 500 | 500 | if (!empty($arrayfields['c.libelle']['checked'])) |
| 501 | 501 | print '<td class="liste_titre"></td>'; |
| 502 | 502 | if (!empty($arrayfields['a.label']['checked'])) |
| 503 | - print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="' . $search_title . '"></td>'; |
|
| 503 | + print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>'; |
|
| 504 | 504 | if (!empty($arrayfields['a.datep']['checked'])) {
|
| 505 | 505 | print '<td class="liste_titre nowraponall" align="center">'; |
| 506 | 506 | print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0); |
@@ -520,11 +520,11 @@ discard block |
||
| 520 | 520 | print '<td class="liste_titre"></td>'; |
| 521 | 521 | |
| 522 | 522 | // Extra fields |
| 523 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php'; |
|
| 523 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
|
| 524 | 524 | |
| 525 | 525 | // Fields from hook |
| 526 | 526 | $parameters = array('arrayfields' => $arrayfields);
|
| 527 | - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 527 | + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 528 | 528 | print $hookmanager->resPrint; |
| 529 | 529 | |
| 530 | 530 | if (!empty($arrayfields['a.datec']['checked'])) |
@@ -566,11 +566,11 @@ discard block |
||
| 566 | 566 | print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "a.fk_element", $param, "", "", $sortfield, $sortorder); |
| 567 | 567 | |
| 568 | 568 | // Extra fields |
| 569 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php'; |
|
| 569 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
|
| 570 | 570 | |
| 571 | 571 | // Hook fields |
| 572 | 572 | $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
|
| 573 | - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 573 | + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 574 | 574 | print $hookmanager->resPrint; |
| 575 | 575 | |
| 576 | 576 | if (!empty($arrayfields['a.datec']['checked'])) |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | $now = dol_now(); |
| 588 | 588 | $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; |
| 589 | 589 | |
| 590 | - require_once DOL_DOCUMENT_ROOT . '/comm/action/class/cactioncomm.class.php'; |
|
| 590 | + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; |
|
| 591 | 591 | $caction = new CActionComm($db); |
| 592 | 592 | $arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1); |
| 593 | 593 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | |
| 619 | 619 | // User owner |
| 620 | 620 | if (!empty($arrayfields['owner']['checked'])) {
|
| 621 | - print '<td class="' . ($conf->browser->name != 'chrome' ? '' : 'tdoverflowmax100') . '">'; // With edge and chrom the td overflow is not supported correctly when content is not full text. |
|
| 621 | + print '<td class="'.($conf->browser->name != 'chrome' ? '' : 'tdoverflowmax100').'">'; // With edge and chrom the td overflow is not supported correctly when content is not full text. |
|
| 622 | 622 | if ($obj->fk_user_action > 0) {
|
| 623 | 623 | $userstatic->fetch($obj->fk_user_action); |
| 624 | 624 | print $userstatic->getNomUrl(-1); |
@@ -635,17 +635,17 @@ discard block |
||
| 635 | 635 | print img_picto('', $actionstatic->type_picto);
|
| 636 | 636 | else {
|
| 637 | 637 | if ($actionstatic->type_code == 'AC_RDV') |
| 638 | - print img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 638 | + print img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
|
|
| 639 | 639 | elseif ($actionstatic->type_code == 'AC_TEL') |
| 640 | - print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 640 | + print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
|
|
| 641 | 641 | elseif ($actionstatic->type_code == 'AC_FAX') |
| 642 | - print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 642 | + print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
|
|
| 643 | 643 | elseif ($actionstatic->type_code == 'AC_EMAIL') |
| 644 | - print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 644 | + print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
|
|
| 645 | 645 | elseif ($actionstatic->type_code == 'AC_INT') |
| 646 | - print img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 646 | + print img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
|
|
| 647 | 647 | elseif (!preg_match('/_AUTO/', $actionstatic->type_code))
|
| 648 | - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 648 | + print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' ';
|
|
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | $labeltype = $obj->type_code; |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) |
| 679 | 679 | $late = 1; |
| 680 | 680 | if ($late) |
| 681 | - print img_warning($langs->trans("Late")) . ' ';
|
|
| 681 | + print img_warning($langs->trans("Late")).' ';
|
|
| 682 | 682 | print '</td>'; |
| 683 | 683 | } |
| 684 | 684 | |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | print '<td>'; |
| 729 | 729 | //var_dump($obj->fkelement.' '.$obj->elementtype); |
| 730 | 730 | if ($obj->fk_element > 0 && !empty($obj->elementtype)) {
|
| 731 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 731 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 732 | 732 | print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1); |
| 733 | 733 | } else {
|
| 734 | 734 | print " "; |
@@ -737,25 +737,25 @@ discard block |
||
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | // Extra fields |
| 740 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
| 740 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
| 741 | 741 | // Fields from hook |
| 742 | 742 | $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj);
|
| 743 | - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 743 | + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 744 | 744 | print $hookmanager->resPrint; |
| 745 | 745 | |
| 746 | 746 | // Date creation |
| 747 | 747 | if (!empty($arrayfields['a.datec']['checked'])) {
|
| 748 | 748 | // Status/Percent |
| 749 | - print '<td align="center" class="nowrap">' . dol_print_date($obj->datec, 'dayhour') . '</td>'; |
|
| 749 | + print '<td align="center" class="nowrap">'.dol_print_date($obj->datec, 'dayhour').'</td>'; |
|
| 750 | 750 | } |
| 751 | 751 | // Date update |
| 752 | 752 | if (!empty($arrayfields['a.tms']['checked'])) {
|
| 753 | - print '<td align="center" class="nowrap">' . dol_print_date($obj->datem, 'dayhour') . '</td>'; |
|
| 753 | + print '<td align="center" class="nowrap">'.dol_print_date($obj->datem, 'dayhour').'</td>'; |
|
| 754 | 754 | } |
| 755 | 755 | if (!empty($arrayfields['a.percent']['checked'])) {
|
| 756 | 756 | // Status/Percent |
| 757 | 757 | $datep = $db->jdate($obj->datep); |
| 758 | - print '<td align="center" class="nowrap">' . $actionstatic->LibStatut($obj->percent, 3, 0, $datep) . '</td>'; |
|
| 758 | + print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent, 3, 0, $datep).'</td>'; |
|
| 759 | 759 | } |
| 760 | 760 | print '<td></td>'; |
| 761 | 761 | |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) |
| 59 | 59 | if (GETPOST('search_actioncode', 'array')) {
|
| 60 | 60 | $actioncode = GETPOST('search_actioncode', 'array', 3);
|
| 61 | - if (!count($actioncode)) |
|
| 62 | - $actioncode = '0'; |
|
| 63 | -} |
|
| 64 | -else {
|
|
| 61 | + if (!count($actioncode)) { |
|
| 62 | + $actioncode = '0'; |
|
| 63 | + } |
|
| 64 | + } else {
|
|
| 65 | 65 | $actioncode = GETPOST("search_actioncode", "alpha", 3) ? GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
| 66 | 66 | } |
| 67 | 67 | if ($actioncode == '' && empty($actioncodearray)) {
|
@@ -108,30 +108,36 @@ discard block |
||
| 108 | 108 | $offset = $limit * $page; |
| 109 | 109 | if (!$sortorder) {
|
| 110 | 110 | $sortorder = "DESC"; |
| 111 | - if ($status == 'todo') |
|
| 112 | - $sortorder = "DESC"; |
|
| 111 | + if ($status == 'todo') { |
|
| 112 | + $sortorder = "DESC"; |
|
| 113 | + } |
|
| 113 | 114 | //if ($status == 'done') $sortorder="DESC"; |
| 114 | 115 | } |
| 115 | 116 | if (!$sortfield) {
|
| 116 | 117 | $sortfield = "a.datep"; |
| 117 | - if ($status == 'todo') |
|
| 118 | - $sortfield = "a.datep"; |
|
| 118 | + if ($status == 'todo') { |
|
| 119 | + $sortfield = "a.datep"; |
|
| 120 | + } |
|
| 119 | 121 | //if ($status == 'done') $sortfield="a.datep2"; |
| 120 | 122 | } |
| 121 | 123 | |
| 122 | 124 | // Security check |
| 123 | 125 | $socid = GETPOST("search_socid", 'int') ? GETPOST("search_socid", 'int') : GETPOST("socid", 'int');
|
| 124 | -if ($user->societe_id) |
|
| 125 | - $socid = $user->societe_id; |
|
| 126 | +if ($user->societe_id) { |
|
| 127 | + $socid = $user->societe_id; |
|
| 128 | +} |
|
| 126 | 129 | $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); |
| 127 | -if ($socid < 0) |
|
| 128 | - $socid = ''; |
|
| 130 | +if ($socid < 0) { |
|
| 131 | + $socid = ''; |
|
| 132 | +} |
|
| 129 | 133 | |
| 130 | 134 | $canedit = 1; |
| 131 | -if (!$user->rights->agenda->myactions->read) |
|
| 132 | - accessforbidden(); |
|
| 133 | -if (!$user->rights->agenda->allactions->read) |
|
| 134 | - $canedit = 0; |
|
| 135 | +if (!$user->rights->agenda->myactions->read) { |
|
| 136 | + accessforbidden(); |
|
| 137 | +} |
|
| 138 | +if (!$user->rights->agenda->allactions->read) { |
|
| 139 | + $canedit = 0; |
|
| 140 | +} |
|
| 135 | 141 | if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
| 136 | 142 | $filtert = $user->id; |
| 137 | 143 | } |
@@ -153,8 +159,9 @@ discard block |
||
| 153 | 159 | // Extra fields |
| 154 | 160 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
| 155 | 161 | foreach ($extrafields->attribute_label as $key => $val) {
|
| 156 | - if (!empty($extrafields->attribute_list[$key])) |
|
| 157 | - $arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], 'checked' => $extrafields->attribute_list[$key], 'position' => $extrafields->attribute_pos[$key], 'enabled' => $extrafields->attribute_perms[$key]);
|
|
| 162 | + if (!empty($extrafields->attribute_list[$key])) { |
|
| 163 | + $arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], 'checked' => $extrafields->attribute_list[$key], 'position' => $extrafields->attribute_pos[$key], 'enabled' => $extrafields->attribute_perms[$key]); |
|
| 164 | + } |
|
| 158 | 165 | } |
| 159 | 166 | } |
| 160 | 167 | |
@@ -177,8 +184,9 @@ discard block |
||
| 177 | 184 | |
| 178 | 185 | $parameters = array('id' => $socid);
|
| 179 | 186 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
| 180 | -if ($reshook < 0) |
|
| 181 | - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 187 | +if ($reshook < 0) { |
|
| 188 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 189 | +} |
|
| 182 | 190 | |
| 183 | 191 | // Selection of new fields |
| 184 | 192 | include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
@@ -215,59 +223,82 @@ discard block |
||
| 215 | 223 | $listofextcals = array(); |
| 216 | 224 | |
| 217 | 225 | $param = ''; |
| 218 | -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) |
|
| 219 | - $param .= '&contextpage=' . urlencode($contextpage); |
|
| 220 | -if ($limit > 0 && $limit != $conf->liste_limit) |
|
| 221 | - $param .= '&limit=' . urlencode($limit); |
|
| 226 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 227 | + $param .= '&contextpage=' . urlencode($contextpage); |
|
| 228 | +} |
|
| 229 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 230 | + $param .= '&limit=' . urlencode($limit); |
|
| 231 | +} |
|
| 222 | 232 | if ($actioncode != '') {
|
| 223 | 233 | if (is_array($actioncode)) {
|
| 224 | - foreach ($actioncode as $str_action) |
|
| 225 | - $param .= "&search_actioncode[]=" . urlencode($str_action); |
|
| 226 | - } else |
|
| 227 | - $param .= "&search_actioncode=" . urlencode($actioncode); |
|
| 228 | -} |
|
| 229 | -if ($resourceid > 0) |
|
| 230 | - $param .= "&search_resourceid=" . urlencode($resourceid); |
|
| 231 | -if ($status != '' && $status > -1) |
|
| 232 | - $param .= "&search_status=" . urlencode($status); |
|
| 233 | -if ($filter) |
|
| 234 | - $param .= "&search_filter=" . urlencode($filter); |
|
| 235 | -if ($filtert) |
|
| 236 | - $param .= "&search_filtert=" . urlencode($filtert); |
|
| 237 | -if ($socid) |
|
| 238 | - $param .= "&search_socid=" . urlencode($socid); |
|
| 239 | -if ($showbirthday) |
|
| 240 | - $param .= "&search_showbirthday=1"; |
|
| 241 | -if ($pid) |
|
| 242 | - $param .= "&search_projectid=" . urlencode($pid); |
|
| 243 | -if ($type) |
|
| 244 | - $param .= "&search_type=" . urlencode($type); |
|
| 245 | -if ($usergroup) |
|
| 246 | - $param .= "&search_usergroup=" . urlencode($usergroup); |
|
| 247 | -if ($search_id != '') |
|
| 248 | - $param .= '&search_title=' . urlencode($search_id); |
|
| 249 | -if ($search_title != '') |
|
| 250 | - $param .= '&search_title=' . urlencode($search_title); |
|
| 251 | -if (GETPOST('datestartday', 'int'))
|
|
| 252 | - $param .= '&datestartday=' . GETPOST('datestartday', 'int');
|
|
| 253 | -if (GETPOST('datestartmonth', 'int'))
|
|
| 254 | - $param .= '&datestartmonth=' . GETPOST('datestartmonth', 'int');
|
|
| 255 | -if (GETPOST('datestartyear', 'int'))
|
|
| 256 | - $param .= '&datestartyear=' . GETPOST('datestartyear', 'int');
|
|
| 257 | -if (GETPOST('dateendday', 'int'))
|
|
| 258 | - $param .= '&dateendday=' . GETPOST('dateendday', 'int');
|
|
| 259 | -if (GETPOST('dateendmonth', 'int'))
|
|
| 260 | - $param .= '&dateendmonth=' . GETPOST('dateendmonth', 'int');
|
|
| 261 | -if (GETPOST('dateendyear', 'int'))
|
|
| 262 | - $param .= '&dateendyear=' . GETPOST('dateendyear', 'int');
|
|
| 263 | -if ($optioncss != '') |
|
| 264 | - $param .= '&optioncss=' . urlencode($optioncss); |
|
| 234 | + foreach ($actioncode as $str_action) { |
|
| 235 | + $param .= "&search_actioncode[]=" . urlencode($str_action); |
|
| 236 | + } |
|
| 237 | + } else { |
|
| 238 | + $param .= "&search_actioncode=" . urlencode($actioncode); |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | +if ($resourceid > 0) { |
|
| 242 | + $param .= "&search_resourceid=" . urlencode($resourceid); |
|
| 243 | +} |
|
| 244 | +if ($status != '' && $status > -1) { |
|
| 245 | + $param .= "&search_status=" . urlencode($status); |
|
| 246 | +} |
|
| 247 | +if ($filter) { |
|
| 248 | + $param .= "&search_filter=" . urlencode($filter); |
|
| 249 | +} |
|
| 250 | +if ($filtert) { |
|
| 251 | + $param .= "&search_filtert=" . urlencode($filtert); |
|
| 252 | +} |
|
| 253 | +if ($socid) { |
|
| 254 | + $param .= "&search_socid=" . urlencode($socid); |
|
| 255 | +} |
|
| 256 | +if ($showbirthday) { |
|
| 257 | + $param .= "&search_showbirthday=1"; |
|
| 258 | +} |
|
| 259 | +if ($pid) { |
|
| 260 | + $param .= "&search_projectid=" . urlencode($pid); |
|
| 261 | +} |
|
| 262 | +if ($type) { |
|
| 263 | + $param .= "&search_type=" . urlencode($type); |
|
| 264 | +} |
|
| 265 | +if ($usergroup) { |
|
| 266 | + $param .= "&search_usergroup=" . urlencode($usergroup); |
|
| 267 | +} |
|
| 268 | +if ($search_id != '') { |
|
| 269 | + $param .= '&search_title=' . urlencode($search_id); |
|
| 270 | +} |
|
| 271 | +if ($search_title != '') { |
|
| 272 | + $param .= '&search_title=' . urlencode($search_title); |
|
| 273 | +} |
|
| 274 | +if (GETPOST('datestartday', 'int')) { |
|
| 275 | + $param .= '&datestartday=' . GETPOST('datestartday', 'int'); |
|
| 276 | +} |
|
| 277 | +if (GETPOST('datestartmonth', 'int')) { |
|
| 278 | + $param .= '&datestartmonth=' . GETPOST('datestartmonth', 'int'); |
|
| 279 | +} |
|
| 280 | +if (GETPOST('datestartyear', 'int')) { |
|
| 281 | + $param .= '&datestartyear=' . GETPOST('datestartyear', 'int'); |
|
| 282 | +} |
|
| 283 | +if (GETPOST('dateendday', 'int')) { |
|
| 284 | + $param .= '&dateendday=' . GETPOST('dateendday', 'int'); |
|
| 285 | +} |
|
| 286 | +if (GETPOST('dateendmonth', 'int')) { |
|
| 287 | + $param .= '&dateendmonth=' . GETPOST('dateendmonth', 'int'); |
|
| 288 | +} |
|
| 289 | +if (GETPOST('dateendyear', 'int')) { |
|
| 290 | + $param .= '&dateendyear=' . GETPOST('dateendyear', 'int'); |
|
| 291 | +} |
|
| 292 | +if ($optioncss != '') { |
|
| 293 | + $param .= '&optioncss=' . urlencode($optioncss); |
|
| 294 | +} |
|
| 265 | 295 | // Add $param from extra fields |
| 266 | 296 | include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php'; |
| 267 | 297 | |
| 268 | 298 | $sql = "SELECT"; |
| 269 | -if ($usergroup > 0) |
|
| 270 | - $sql .= " DISTINCT"; |
|
| 299 | +if ($usergroup > 0) { |
|
| 300 | + $sql .= " DISTINCT"; |
|
| 301 | +} |
|
| 271 | 302 | $sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,"; |
| 272 | 303 | $sql .= " a.id, a.label, a.datep as dp, a.datep2 as dp2,"; |
| 273 | 304 | $sql .= ' a.fk_user_author,a.fk_user_action,'; |
@@ -276,45 +307,51 @@ discard block |
||
| 276 | 307 | $sql .= " c.code as type_code, c.libelle as type_label,"; |
| 277 | 308 | $sql .= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; |
| 278 | 309 | // Add fields from extrafields |
| 279 | -foreach ($extrafields->attribute_label as $key => $val) |
|
| 280 | - $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : ''); |
|
| 310 | +foreach ($extrafields->attribute_label as $key => $val) { |
|
| 311 | + $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : ''); |
|
| 312 | +} |
|
| 281 | 313 | $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a"; |
| 282 | 314 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "actioncomm_extrafields as ef ON (a.id = ef.fk_object) "; |
| 283 | -if (!$user->rights->societe->client->voir && !$socid) |
|
| 284 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 315 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 316 | + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 317 | +} |
|
| 285 | 318 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON a.fk_soc = s.rowid"; |
| 286 | 319 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sp ON a.fk_contact = sp.rowid"; |
| 287 | 320 | $sql .= " ," . MAIN_DB_PREFIX . "c_actioncomm as c"; |
| 288 | 321 | // We must filter on resource table |
| 289 | -if ($resourceid > 0) |
|
| 290 | - $sql .= ", " . MAIN_DB_PREFIX . "element_resources as r"; |
|
| 322 | +if ($resourceid > 0) { |
|
| 323 | + $sql .= ", " . MAIN_DB_PREFIX . "element_resources as r"; |
|
| 324 | +} |
|
| 291 | 325 | // We must filter on assignement table |
| 292 | -if ($filtert > 0 || $usergroup > 0) |
|
| 293 | - $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 294 | -if ($usergroup > 0) |
|
| 295 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 326 | +if ($filtert > 0 || $usergroup > 0) { |
|
| 327 | + $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 328 | +} |
|
| 329 | +if ($usergroup > 0) { |
|
| 330 | + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 331 | +} |
|
| 296 | 332 | $sql .= " WHERE c.id = a.fk_action"; |
| 297 | 333 | $sql .= ' AND a.entity IN (' . getEntity('agenda') . ')';
|
| 298 | 334 | // Condition on actioncode |
| 299 | 335 | if (!empty($actioncode)) {
|
| 300 | 336 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
| 301 | - if ($actioncode == 'AC_NON_AUTO') |
|
| 302 | - $sql .= " AND c.type != 'systemauto'"; |
|
| 303 | - elseif ($actioncode == 'AC_ALL_AUTO') |
|
| 304 | - $sql .= " AND c.type = 'systemauto'"; |
|
| 305 | - else {
|
|
| 306 | - if ($actioncode == 'AC_OTH') |
|
| 307 | - $sql .= " AND c.type != 'systemauto'"; |
|
| 308 | - if ($actioncode == 'AC_OTH_AUTO') |
|
| 309 | - $sql .= " AND c.type = 'systemauto'"; |
|
| 337 | + if ($actioncode == 'AC_NON_AUTO') { |
|
| 338 | + $sql .= " AND c.type != 'systemauto'"; |
|
| 339 | + } elseif ($actioncode == 'AC_ALL_AUTO') { |
|
| 340 | + $sql .= " AND c.type = 'systemauto'"; |
|
| 341 | + } else {
|
|
| 342 | + if ($actioncode == 'AC_OTH') { |
|
| 343 | + $sql .= " AND c.type != 'systemauto'"; |
|
| 344 | + } |
|
| 345 | + if ($actioncode == 'AC_OTH_AUTO') { |
|
| 346 | + $sql .= " AND c.type = 'systemauto'"; |
|
| 347 | + } |
|
| 310 | 348 | } |
| 311 | - } |
|
| 312 | - else {
|
|
| 313 | - if ($actioncode == 'AC_NON_AUTO') |
|
| 314 | - $sql .= " AND c.type != 'systemauto'"; |
|
| 315 | - elseif ($actioncode == 'AC_ALL_AUTO') |
|
| 316 | - $sql .= " AND c.type = 'systemauto'"; |
|
| 317 | - else {
|
|
| 349 | + } else {
|
|
| 350 | + if ($actioncode == 'AC_NON_AUTO') { |
|
| 351 | + $sql .= " AND c.type != 'systemauto'"; |
|
| 352 | + } elseif ($actioncode == 'AC_ALL_AUTO') { |
|
| 353 | + $sql .= " AND c.type = 'systemauto'"; |
|
| 354 | + } else {
|
|
| 318 | 355 | if (is_array($actioncode)) {
|
| 319 | 356 | $sql .= " AND c.code IN ('" . implode("','", $actioncode) . "')";
|
| 320 | 357 | } else {
|
@@ -323,19 +360,25 @@ discard block |
||
| 323 | 360 | } |
| 324 | 361 | } |
| 325 | 362 | } |
| 326 | -if ($resourceid > 0) |
|
| 327 | - $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = " . $db->escape($resourceid); |
|
| 328 | -if ($pid) |
|
| 329 | - $sql .= " AND a.fk_project=" . $db->escape($pid); |
|
| 330 | -if (!$user->rights->societe->client->voir && !$socid) |
|
| 331 | - $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 332 | -if ($socid > 0) |
|
| 333 | - $sql .= " AND s.rowid = " . $socid; |
|
| 363 | +if ($resourceid > 0) { |
|
| 364 | + $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = " . $db->escape($resourceid); |
|
| 365 | +} |
|
| 366 | +if ($pid) { |
|
| 367 | + $sql .= " AND a.fk_project=" . $db->escape($pid); |
|
| 368 | +} |
|
| 369 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 370 | + $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 371 | +} |
|
| 372 | +if ($socid > 0) { |
|
| 373 | + $sql .= " AND s.rowid = " . $socid; |
|
| 374 | +} |
|
| 334 | 375 | // We must filter on assignement table |
| 335 | -if ($filtert > 0 || $usergroup > 0) |
|
| 336 | - $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
|
| 337 | -if ($type) |
|
| 338 | - $sql .= " AND c.id = " . $type; |
|
| 376 | +if ($filtert > 0 || $usergroup > 0) { |
|
| 377 | + $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
|
| 378 | +} |
|
| 379 | +if ($type) { |
|
| 380 | + $sql .= " AND c.id = " . $type; |
|
| 381 | +} |
|
| 339 | 382 | if ($status == '0') {
|
| 340 | 383 | $sql .= " AND a.percent = 0"; |
| 341 | 384 | } |
@@ -354,27 +397,35 @@ discard block |
||
| 354 | 397 | if ($status == 'todo') {
|
| 355 | 398 | $sql .= " AND (a.percent >= 0 AND a.percent < 100)"; |
| 356 | 399 | } |
| 357 | -if ($search_id) |
|
| 358 | - $sql .= natural_search("a.id", $search_id, 1);
|
|
| 359 | -if ($search_title) |
|
| 360 | - $sql .= natural_search("a.label", $search_title);
|
|
| 400 | +if ($search_id) { |
|
| 401 | + $sql .= natural_search("a.id", $search_id, 1); |
|
| 402 | +} |
|
| 403 | +if ($search_title) { |
|
| 404 | + $sql .= natural_search("a.label", $search_title); |
|
| 405 | +} |
|
| 361 | 406 | // We must filter on assignement table |
| 362 | 407 | if ($filtert > 0 || $usergroup > 0) {
|
| 363 | 408 | $sql .= " AND (";
|
| 364 | - if ($filtert > 0) |
|
| 365 | - $sql .= "(ar.fk_element = " . $filtert . " OR (ar.fk_element IS NULL AND a.fk_user_action=" . $filtert . "))"; // The OR is for backward compatibility |
|
| 366 | - if ($usergroup > 0) |
|
| 367 | - $sql .= ($filtert > 0 ? " OR " : "") . " ugu.fk_usergroup = " . $usergroup; |
|
| 409 | + if ($filtert > 0) { |
|
| 410 | + $sql .= "(ar.fk_element = " . $filtert . " OR (ar.fk_element IS NULL AND a.fk_user_action=" . $filtert . "))"; |
|
| 411 | + } |
|
| 412 | + // The OR is for backward compatibility |
|
| 413 | + if ($usergroup > 0) { |
|
| 414 | + $sql .= ($filtert > 0 ? " OR " : "") . " ugu.fk_usergroup = " . $usergroup; |
|
| 415 | + } |
|
| 368 | 416 | $sql .= ")"; |
| 369 | 417 | } |
| 370 | 418 | |
| 371 | 419 | // The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case) |
| 372 | -if ($dateselect > 0) |
|
| 373 | - $sql .= " AND ((a.datep2 >= '" . $db->idate($dateselect) . "' AND a.datep <= '" . $db->idate($dateselect + 3600 * 24 - 1) . "') OR (a.datep2 IS NULL AND a.datep > '" . $db->idate($dateselect - 3600) . "' AND a.datep <= '" . $db->idate($dateselect + 3600 * 24 - 1) . "'))"; |
|
| 374 | -if ($datestart > 0) |
|
| 375 | - $sql .= " AND a.datep BETWEEN '" . $db->idate($datestart) . "' AND '" . $db->idate($datestart + 3600 * 24 - 1) . "'"; |
|
| 376 | -if ($dateend > 0) |
|
| 377 | - $sql .= " AND a.datep2 BETWEEN '" . $db->idate($dateend) . "' AND '" . $db->idate($dateend + 3600 * 24 - 1) . "'"; |
|
| 420 | +if ($dateselect > 0) { |
|
| 421 | + $sql .= " AND ((a.datep2 >= '" . $db->idate($dateselect) . "' AND a.datep <= '" . $db->idate($dateselect + 3600 * 24 - 1) . "') OR (a.datep2 IS NULL AND a.datep > '" . $db->idate($dateselect - 3600) . "' AND a.datep <= '" . $db->idate($dateselect + 3600 * 24 - 1) . "'))"; |
|
| 422 | +} |
|
| 423 | +if ($datestart > 0) { |
|
| 424 | + $sql .= " AND a.datep BETWEEN '" . $db->idate($datestart) . "' AND '" . $db->idate($datestart + 3600 * 24 - 1) . "'"; |
|
| 425 | +} |
|
| 426 | +if ($dateend > 0) { |
|
| 427 | + $sql .= " AND a.datep2 BETWEEN '" . $db->idate($dateend) . "' AND '" . $db->idate($dateend + 3600 * 24 - 1) . "'"; |
|
| 428 | +} |
|
| 378 | 429 | // Add where from extra fields |
| 379 | 430 | include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php'; |
| 380 | 431 | |
@@ -411,8 +462,9 @@ discard block |
||
| 411 | 462 | |
| 412 | 463 | print '<form method="POST" id="searchFormList" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '">' . "\n"; |
| 413 | 464 | |
| 414 | - if ($optioncss != '') |
|
| 415 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 465 | + if ($optioncss != '') { |
|
| 466 | + print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 467 | + } |
|
| 416 | 468 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
| 417 | 469 | print '<input type="hidden" name="action" value="list">'; |
| 418 | 470 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
@@ -424,12 +476,14 @@ discard block |
||
| 424 | 476 | |
| 425 | 477 | //if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
| 426 | 478 | //if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">'; |
| 427 | - if ($filter) |
|
| 428 | - $nav .= '<input type="hidden" name="search_filter" value="' . $filter . '">'; |
|
| 479 | + if ($filter) { |
|
| 480 | + $nav .= '<input type="hidden" name="search_filter" value="' . $filter . '">'; |
|
| 481 | + } |
|
| 429 | 482 | //if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; |
| 430 | 483 | //if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; |
| 431 | - if ($showbirthday) |
|
| 432 | - $nav .= '<input type="hidden" name="search_showbirthday" value="1">'; |
|
| 484 | + if ($showbirthday) { |
|
| 485 | + $nav .= '<input type="hidden" name="search_showbirthday" value="1">'; |
|
| 486 | + } |
|
| 433 | 487 | //if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; |
| 434 | 488 | //if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; |
| 435 | 489 | print $nav; |
@@ -486,21 +540,26 @@ discard block |
||
| 486 | 540 | |
| 487 | 541 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
| 488 | 542 | $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
| 489 | - if ($massactionbutton) |
|
| 490 | - $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
|
| 543 | + if ($massactionbutton) { |
|
| 544 | + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); |
|
| 545 | + } |
|
| 491 | 546 | $i = 0; |
| 492 | 547 | print '<div class="div-table-responsive">'; |
| 493 | 548 | print '<table class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; |
| 494 | 549 | |
| 495 | 550 | print '<tr class="liste_titre_filter">'; |
| 496 | - if (!empty($arrayfields['a.id']['checked'])) |
|
| 497 | - print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="' . $search_id . '"></td>'; |
|
| 498 | - if (!empty($arrayfields['owner']['checked'])) |
|
| 499 | - print '<td class="liste_titre"></td>'; |
|
| 500 | - if (!empty($arrayfields['c.libelle']['checked'])) |
|
| 501 | - print '<td class="liste_titre"></td>'; |
|
| 502 | - if (!empty($arrayfields['a.label']['checked'])) |
|
| 503 | - print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="' . $search_title . '"></td>'; |
|
| 551 | + if (!empty($arrayfields['a.id']['checked'])) { |
|
| 552 | + print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="' . $search_id . '"></td>'; |
|
| 553 | + } |
|
| 554 | + if (!empty($arrayfields['owner']['checked'])) { |
|
| 555 | + print '<td class="liste_titre"></td>'; |
|
| 556 | + } |
|
| 557 | + if (!empty($arrayfields['c.libelle']['checked'])) { |
|
| 558 | + print '<td class="liste_titre"></td>'; |
|
| 559 | + } |
|
| 560 | + if (!empty($arrayfields['a.label']['checked'])) { |
|
| 561 | + print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="' . $search_title . '"></td>'; |
|
| 562 | + } |
|
| 504 | 563 | if (!empty($arrayfields['a.datep']['checked'])) {
|
| 505 | 564 | print '<td class="liste_titre nowraponall" align="center">'; |
| 506 | 565 | print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0); |
@@ -514,10 +573,12 @@ discard block |
||
| 514 | 573 | if (!empty($arrayfields['s.nom']['checked'])) {
|
| 515 | 574 | print '<td class="liste_titre"></td>'; |
| 516 | 575 | } |
| 517 | - if (!empty($arrayfields['a.fk_contact']['checked'])) |
|
| 518 | - print '<td class="liste_titre"></td>'; |
|
| 519 | - if (!empty($arrayfields['a.fk_element']['checked'])) |
|
| 520 | - print '<td class="liste_titre"></td>'; |
|
| 576 | + if (!empty($arrayfields['a.fk_contact']['checked'])) { |
|
| 577 | + print '<td class="liste_titre"></td>'; |
|
| 578 | + } |
|
| 579 | + if (!empty($arrayfields['a.fk_element']['checked'])) { |
|
| 580 | + print '<td class="liste_titre"></td>'; |
|
| 581 | + } |
|
| 521 | 582 | |
| 522 | 583 | // Extra fields |
| 523 | 584 | include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php'; |
@@ -527,10 +588,12 @@ discard block |
||
| 527 | 588 | $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
| 528 | 589 | print $hookmanager->resPrint; |
| 529 | 590 | |
| 530 | - if (!empty($arrayfields['a.datec']['checked'])) |
|
| 531 | - print '<td class="liste_titre"></td>'; |
|
| 532 | - if (!empty($arrayfields['a.tms']['checked'])) |
|
| 533 | - print '<td class="liste_titre"></td>'; |
|
| 591 | + if (!empty($arrayfields['a.datec']['checked'])) { |
|
| 592 | + print '<td class="liste_titre"></td>'; |
|
| 593 | + } |
|
| 594 | + if (!empty($arrayfields['a.tms']['checked'])) { |
|
| 595 | + print '<td class="liste_titre"></td>'; |
|
| 596 | + } |
|
| 534 | 597 | if (!empty($arrayfields['a.percent']['checked'])) {
|
| 535 | 598 | print '<td class="liste_titre center">'; |
| 536 | 599 | print $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
|
@@ -545,25 +608,34 @@ discard block |
||
| 545 | 608 | print "</tr>\n"; |
| 546 | 609 | |
| 547 | 610 | print '<tr class="liste_titre">'; |
| 548 | - if (!empty($arrayfields['a.id']['checked'])) |
|
| 549 | - print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder); |
|
| 550 | - if (!empty($arrayfields['owner']['checked'])) |
|
| 551 | - print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); |
|
| 552 | - if (!empty($arrayfields['c.libelle']['checked'])) |
|
| 553 | - print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder); |
|
| 554 | - if (!empty($arrayfields['a.label']['checked'])) |
|
| 555 | - print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder); |
|
| 611 | + if (!empty($arrayfields['a.id']['checked'])) { |
|
| 612 | + print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder); |
|
| 613 | + } |
|
| 614 | + if (!empty($arrayfields['owner']['checked'])) { |
|
| 615 | + print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); |
|
| 616 | + } |
|
| 617 | + if (!empty($arrayfields['c.libelle']['checked'])) { |
|
| 618 | + print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder); |
|
| 619 | + } |
|
| 620 | + if (!empty($arrayfields['a.label']['checked'])) { |
|
| 621 | + print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder); |
|
| 622 | + } |
|
| 556 | 623 | //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) |
| 557 | - if (!empty($arrayfields['a.datep']['checked'])) |
|
| 558 | - print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep", $param, '', 'align="center"', $sortfield, $sortorder); |
|
| 559 | - if (!empty($arrayfields['a.datep2']['checked'])) |
|
| 560 | - print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder); |
|
| 561 | - if (!empty($arrayfields['s.nom']['checked'])) |
|
| 562 | - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder); |
|
| 563 | - if (!empty($arrayfields['a.fk_contact']['checked'])) |
|
| 564 | - print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "a.fk_contact", $param, "", "", $sortfield, $sortorder); |
|
| 565 | - if (!empty($arrayfields['a.fk_element']['checked'])) |
|
| 566 | - print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "a.fk_element", $param, "", "", $sortfield, $sortorder); |
|
| 624 | + if (!empty($arrayfields['a.datep']['checked'])) { |
|
| 625 | + print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep", $param, '', 'align="center"', $sortfield, $sortorder); |
|
| 626 | + } |
|
| 627 | + if (!empty($arrayfields['a.datep2']['checked'])) { |
|
| 628 | + print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder); |
|
| 629 | + } |
|
| 630 | + if (!empty($arrayfields['s.nom']['checked'])) { |
|
| 631 | + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder); |
|
| 632 | + } |
|
| 633 | + if (!empty($arrayfields['a.fk_contact']['checked'])) { |
|
| 634 | + print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "a.fk_contact", $param, "", "", $sortfield, $sortorder); |
|
| 635 | + } |
|
| 636 | + if (!empty($arrayfields['a.fk_element']['checked'])) { |
|
| 637 | + print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "a.fk_element", $param, "", "", $sortfield, $sortorder); |
|
| 638 | + } |
|
| 567 | 639 | |
| 568 | 640 | // Extra fields |
| 569 | 641 | include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php'; |
@@ -573,13 +645,16 @@ discard block |
||
| 573 | 645 | $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
| 574 | 646 | print $hookmanager->resPrint; |
| 575 | 647 | |
| 576 | - if (!empty($arrayfields['a.datec']['checked'])) |
|
| 577 | - print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder); |
|
| 578 | - if (!empty($arrayfields['a.tms']['checked'])) |
|
| 579 | - print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder); |
|
| 648 | + if (!empty($arrayfields['a.datec']['checked'])) { |
|
| 649 | + print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder); |
|
| 650 | + } |
|
| 651 | + if (!empty($arrayfields['a.tms']['checked'])) { |
|
| 652 | + print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder); |
|
| 653 | + } |
|
| 580 | 654 | |
| 581 | - if (!empty($arrayfields['a.percent']['checked'])) |
|
| 582 | - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder);
|
|
| 655 | + if (!empty($arrayfields['a.percent']['checked'])) { |
|
| 656 | + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder); |
|
| 657 | + } |
|
| 583 | 658 | print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); |
| 584 | 659 | print "</tr>\n"; |
| 585 | 660 | |
@@ -622,8 +697,9 @@ discard block |
||
| 622 | 697 | if ($obj->fk_user_action > 0) {
|
| 623 | 698 | $userstatic->fetch($obj->fk_user_action); |
| 624 | 699 | print $userstatic->getNomUrl(-1); |
| 625 | - } else |
|
| 626 | - print ' '; |
|
| 700 | + } else { |
|
| 701 | + print ' '; |
|
| 702 | + } |
|
| 627 | 703 | print '</td>'; |
| 628 | 704 | } |
| 629 | 705 | |
@@ -631,28 +707,31 @@ discard block |
||
| 631 | 707 | if (!empty($arrayfields['c.libelle']['checked'])) {
|
| 632 | 708 | print '<td>'; |
| 633 | 709 | if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
| 634 | - if ($actionstatic->type_picto) |
|
| 635 | - print img_picto('', $actionstatic->type_picto);
|
|
| 636 | - else {
|
|
| 637 | - if ($actionstatic->type_code == 'AC_RDV') |
|
| 638 | - print img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 639 | - elseif ($actionstatic->type_code == 'AC_TEL') |
|
| 640 | - print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 641 | - elseif ($actionstatic->type_code == 'AC_FAX') |
|
| 642 | - print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 643 | - elseif ($actionstatic->type_code == 'AC_EMAIL') |
|
| 644 | - print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 645 | - elseif ($actionstatic->type_code == 'AC_INT') |
|
| 646 | - print img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 647 | - elseif (!preg_match('/_AUTO/', $actionstatic->type_code))
|
|
| 648 | - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright') . ' ';
|
|
| 710 | + if ($actionstatic->type_picto) { |
|
| 711 | + print img_picto('', $actionstatic->type_picto); |
|
| 712 | + } else {
|
|
| 713 | + if ($actionstatic->type_code == 'AC_RDV') { |
|
| 714 | + print img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright') . ' '; |
|
| 715 | + } elseif ($actionstatic->type_code == 'AC_TEL') { |
|
| 716 | + print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright') . ' '; |
|
| 717 | + } elseif ($actionstatic->type_code == 'AC_FAX') { |
|
| 718 | + print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright') . ' '; |
|
| 719 | + } elseif ($actionstatic->type_code == 'AC_EMAIL') { |
|
| 720 | + print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright') . ' '; |
|
| 721 | + } elseif ($actionstatic->type_code == 'AC_INT') { |
|
| 722 | + print img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright') . ' '; |
|
| 723 | + } elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) { |
|
| 724 | + print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright') . ' '; |
|
| 725 | + } |
|
| 649 | 726 | } |
| 650 | 727 | } |
| 651 | 728 | $labeltype = $obj->type_code; |
| 652 | - if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) |
|
| 653 | - $labeltype = 'AC_OTH'; |
|
| 654 | - if (!empty($arraylist[$labeltype])) |
|
| 655 | - $labeltype = $arraylist[$labeltype]; |
|
| 729 | + if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) { |
|
| 730 | + $labeltype = 'AC_OTH'; |
|
| 731 | + } |
|
| 732 | + if (!empty($arraylist[$labeltype])) { |
|
| 733 | + $labeltype = $arraylist[$labeltype]; |
|
| 734 | + } |
|
| 656 | 735 | print dol_trunc($labeltype, 28); |
| 657 | 736 | print '</td>'; |
| 658 | 737 | } |
@@ -669,16 +748,21 @@ discard block |
||
| 669 | 748 | print '<td align="center">'; |
| 670 | 749 | print dol_print_date($db->jdate($obj->dp), "dayhour"); |
| 671 | 750 | $late = 0; |
| 672 | - if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) |
|
| 673 | - $late = 1; |
|
| 674 | - if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) |
|
| 675 | - $late = 1; |
|
| 676 | - if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) |
|
| 677 | - $late = 1; |
|
| 678 | - if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) |
|
| 679 | - $late = 1; |
|
| 680 | - if ($late) |
|
| 681 | - print img_warning($langs->trans("Late")) . ' ';
|
|
| 751 | + if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) { |
|
| 752 | + $late = 1; |
|
| 753 | + } |
|
| 754 | + if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) { |
|
| 755 | + $late = 1; |
|
| 756 | + } |
|
| 757 | + if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) { |
|
| 758 | + $late = 1; |
|
| 759 | + } |
|
| 760 | + if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) { |
|
| 761 | + $late = 1; |
|
| 762 | + } |
|
| 763 | + if ($late) { |
|
| 764 | + print img_warning($langs->trans("Late")) . ' '; |
|
| 765 | + } |
|
| 682 | 766 | print '</td>'; |
| 683 | 767 | } |
| 684 | 768 | |
@@ -699,8 +783,9 @@ discard block |
||
| 699 | 783 | $societestatic->email = $obj->socemail; |
| 700 | 784 | |
| 701 | 785 | print $societestatic->getNomUrl(1, '', 28); |
| 702 | - } else |
|
| 703 | - print ' '; |
|
| 786 | + } else { |
|
| 787 | + print ' '; |
|
| 788 | + } |
|
| 704 | 789 | print '</td>'; |
| 705 | 790 | } |
| 706 | 791 | |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | * \ingroup agenda |
| 33 | 33 | * \brief Home page of calendar events |
| 34 | 34 | */ |
| 35 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 35 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 36 | 36 | |
| 37 | -require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
| 38 | -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 39 | -require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 41 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/agenda.lib.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 38 | +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 39 | +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 41 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; |
|
| 42 | 42 | if (!empty($conf->projet->enabled)) {
|
| 43 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
| 43 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $week = GETPOST("week", "int") ? GETPOST("week", "int") : date("W");
|
| 98 | 98 | $day = GETPOST("day", "int") ? GETPOST("day", "int") : date("d");
|
| 99 | 99 | $pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
|
| 100 | -$status = GETPOST("search_status", 'aZ09') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
|
|
| 100 | +$status = GETPOST("search_status", 'aZ09') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
|
|
| 101 | 101 | $type = GETPOST("search_type", 'az09') ? GETPOST("search_type", 'az09') : GETPOST("type", 'az09');
|
| 102 | 102 | $maxprint = (isset($_GET["maxprint"]) ? GETPOST("maxprint") : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
| 103 | 103 | // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | foreach ($_POST as $key => $val) {
|
| 153 | 153 | if ($key == 'token') |
| 154 | 154 | continue; |
| 155 | - $param .= '&' . $key . '=' . urlencode($val); |
|
| 155 | + $param .= '&'.$key.'='.urlencode($val); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | //print $param; |
| 159 | - header("Location: " . DOL_URL_ROOT . '/comm/action/list.php?' . $param);
|
|
| 159 | + header("Location: ".DOL_URL_ROOT.'/comm/action/list.php?'.$param);
|
|
| 160 | 160 | exit; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -166,11 +166,11 @@ discard block |
||
| 166 | 166 | foreach ($_POST as $key => $val) {
|
| 167 | 167 | if ($key == 'token') |
| 168 | 168 | continue; |
| 169 | - $param .= '&' . $key . '=' . urlencode($val); |
|
| 169 | + $param .= '&'.$key.'='.urlencode($val); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | //print $param; |
| 173 | - header("Location: " . DOL_URL_ROOT . '/comm/action/peruser.php?' . $param);
|
|
| 173 | + header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
|
|
| 174 | 174 | exit; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | $i = 0; |
| 206 | 206 | while ($i < $MAXAGENDA) {
|
| 207 | 207 | $i++; |
| 208 | - $source = 'AGENDA_EXT_SRC' . $i; |
|
| 209 | - $name = 'AGENDA_EXT_NAME' . $i; |
|
| 210 | - $offsettz = 'AGENDA_EXT_OFFSETTZ' . $i; |
|
| 211 | - $color = 'AGENDA_EXT_COLOR' . $i; |
|
| 212 | - $buggedfile = 'AGENDA_EXT_BUGGEDFILE' . $i; |
|
| 208 | + $source = 'AGENDA_EXT_SRC'.$i; |
|
| 209 | + $name = 'AGENDA_EXT_NAME'.$i; |
|
| 210 | + $offsettz = 'AGENDA_EXT_OFFSETTZ'.$i; |
|
| 211 | + $color = 'AGENDA_EXT_COLOR'.$i; |
|
| 212 | + $buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i; |
|
| 213 | 213 | if (!empty($conf->global->$source) && !empty($conf->global->$name)) {
|
| 214 | 214 | // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' |
| 215 | 215 | $listofextcals[] = array('src' => $conf->global->$source, 'name' => $conf->global->$name, 'offsettz' => $conf->global->$offsettz, 'color' => $conf->global->$color, 'buggedfile' => (isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0));
|
@@ -221,12 +221,12 @@ discard block |
||
| 221 | 221 | $i = 0; |
| 222 | 222 | while ($i < $MAXAGENDA) {
|
| 223 | 223 | $i++; |
| 224 | - $source = 'AGENDA_EXT_SRC_' . $user->id . '_' . $i; |
|
| 225 | - $name = 'AGENDA_EXT_NAME_' . $user->id . '_' . $i; |
|
| 226 | - $offsettz = 'AGENDA_EXT_OFFSETTZ_' . $user->id . '_' . $i; |
|
| 227 | - $color = 'AGENDA_EXT_COLOR_' . $user->id . '_' . $i; |
|
| 228 | - $enabled = 'AGENDA_EXT_ENABLED_' . $user->id . '_' . $i; |
|
| 229 | - $buggedfile = 'AGENDA_EXT_BUGGEDFILE_' . $user->id . '_' . $i; |
|
| 224 | + $source = 'AGENDA_EXT_SRC_'.$user->id.'_'.$i; |
|
| 225 | + $name = 'AGENDA_EXT_NAME_'.$user->id.'_'.$i; |
|
| 226 | + $offsettz = 'AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i; |
|
| 227 | + $color = 'AGENDA_EXT_COLOR_'.$user->id.'_'.$i; |
|
| 228 | + $enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i; |
|
| 229 | + $buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i; |
|
| 230 | 230 | if (!empty($user->conf->$source) && !empty($user->conf->$name)) {
|
| 231 | 231 | // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' |
| 232 | 232 | $listofextcals[] = array('src' => $user->conf->$source, 'name' => $user->conf->$name, 'offsettz' => $user->conf->$offsettz, 'color' => $user->conf->$color, 'buggedfile' => (isset($user->conf->buggedfile) ? $user->conf->buggedfile : 0));
|
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | $next_year = $next['year']; |
| 243 | 243 | $next_month = $next['month']; |
| 244 | 244 | |
| 245 | - $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year)); // Nb of days in previous month
|
|
| 246 | - $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month
|
|
| 245 | + $max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year)); // Nb of days in previous month
|
|
| 246 | + $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month
|
|
| 247 | 247 | // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) |
| 248 | - $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday
|
|
| 248 | + $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday
|
|
| 249 | 249 | $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); |
| 250 | 250 | if ($tmpday >= 1) |
| 251 | 251 | $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. |
@@ -312,60 +312,60 @@ discard block |
||
| 312 | 312 | if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) {
|
| 313 | 313 | if (is_array($actioncode)) {
|
| 314 | 314 | foreach ($actioncode as $str_action) |
| 315 | - $param .= "&search_actioncode[]=" . urlencode($str_action); |
|
| 315 | + $param .= "&search_actioncode[]=".urlencode($str_action); |
|
| 316 | 316 | } else |
| 317 | - $param .= "&search_actioncode=" . urlencode($actioncode); |
|
| 317 | + $param .= "&search_actioncode=".urlencode($actioncode); |
|
| 318 | 318 | } |
| 319 | 319 | if ($resourceid > 0) |
| 320 | - $param .= "&search_resourceid=" . urlencode($resourceid); |
|
| 320 | + $param .= "&search_resourceid=".urlencode($resourceid); |
|
| 321 | 321 | if ($status || isset($_GET['status']) || isset($_POST['status'])) |
| 322 | - $param .= "&search_status=" . urlencode($status); |
|
| 322 | + $param .= "&search_status=".urlencode($status); |
|
| 323 | 323 | if ($filter) |
| 324 | - $param .= "&search_filter=" . urlencode($filter); |
|
| 324 | + $param .= "&search_filter=".urlencode($filter); |
|
| 325 | 325 | if ($filtert) |
| 326 | - $param .= "&search_filtert=" . urlencode($filtert); |
|
| 326 | + $param .= "&search_filtert=".urlencode($filtert); |
|
| 327 | 327 | if ($usergroup) |
| 328 | - $param .= "&search_usergroup=" . urlencode($usergroup); |
|
| 328 | + $param .= "&search_usergroup=".urlencode($usergroup); |
|
| 329 | 329 | if ($socid) |
| 330 | - $param .= "&search_socid=" . urlencode($socid); |
|
| 330 | + $param .= "&search_socid=".urlencode($socid); |
|
| 331 | 331 | if ($showbirthday) |
| 332 | 332 | $param .= "&search_showbirthday=1"; |
| 333 | 333 | if ($pid) |
| 334 | - $param .= "&search_projectid=" . urlencode($pid); |
|
| 334 | + $param .= "&search_projectid=".urlencode($pid); |
|
| 335 | 335 | if ($type) |
| 336 | - $param .= "&search_type=" . urlencode($type); |
|
| 336 | + $param .= "&search_type=".urlencode($type); |
|
| 337 | 337 | if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') |
| 338 | - $param .= '&action=' . urlencode($action); |
|
| 339 | -$param .= "&maxprint=" . urlencode($maxprint); |
|
| 338 | + $param .= '&action='.urlencode($action); |
|
| 339 | +$param .= "&maxprint=".urlencode($maxprint); |
|
| 340 | 340 | |
| 341 | 341 | // Show navigation bar |
| 342 | 342 | if (empty($action) || $action == 'show_month') {
|
| 343 | - $nav = "<a href=\"?year=" . $prev_year . "&month=" . $prev_month . $param . "\"><i class=\"fa fa-chevron-left\"></i></a> \n"; |
|
| 344 | - $nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y"); |
|
| 343 | + $nav = "<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> \n"; |
|
| 344 | + $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y"); |
|
| 345 | 345 | $nav .= " </span>\n"; |
| 346 | - $nav .= " <a href=\"?year=" . $next_year . "&month=" . $next_month . $param . "\"><i class=\"fa fa-chevron-right\"></i></a>\n"; |
|
| 347 | - $nav .= " (<a href=\"?year=" . $nowyear . "&month=" . $nowmonth . $param . "\">" . $langs->trans("Today") . "</a>)";
|
|
| 346 | + $nav .= " <a href=\"?year=".$next_year."&month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n"; |
|
| 347 | + $nav .= " (<a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a>)";
|
|
| 348 | 348 | $picto = 'calendar'; |
| 349 | 349 | } |
| 350 | 350 | if ($action == 'show_week') {
|
| 351 | - $nav = "<a href=\"?year=" . $prev_year . "&month=" . $prev_month . "&day=" . $prev_day . $param . "\"><i class=\"fa fa-chevron-left\" title=\"" . dol_escape_htmltag($langs->trans("Previous")) . "\"></i></a> \n";
|
|
| 352 | - $nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y") . ", " . $langs->trans("Week") . " " . $week;
|
|
| 351 | + $nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> \n";
|
|
| 352 | + $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
|
|
| 353 | 353 | $nav .= " </span>\n"; |
| 354 | - $nav .= " <a href=\"?year=" . $next_year . "&month=" . $next_month . "&day=" . $next_day . $param . "\"><i class=\"fa fa-chevron-right\" title=\"" . dol_escape_htmltag($langs->trans("Next")) . "\"></i></a>\n";
|
|
| 355 | - $nav .= " (<a href=\"?year=" . $nowyear . "&month=" . $nowmonth . "&day=" . $nowday . $param . "\">" . $langs->trans("Today") . "</a>)";
|
|
| 354 | + $nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
|
|
| 355 | + $nav .= " (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
|
| 356 | 356 | $picto = 'calendarweek'; |
| 357 | 357 | } |
| 358 | 358 | if ($action == 'show_day') {
|
| 359 | - $nav = "<a href=\"?year=" . $prev_year . "&month=" . $prev_month . "&day=" . $prev_day . $param . "\"><i class=\"fa fa-chevron-left\"></i></a> \n"; |
|
| 360 | - $nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort"); |
|
| 359 | + $nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\"></i></a> \n"; |
|
| 360 | + $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort"); |
|
| 361 | 361 | $nav .= " </span>\n"; |
| 362 | - $nav .= " <a href=\"?year=" . $next_year . "&month=" . $next_month . "&day=" . $next_day . $param . "\"><i class=\"fa fa-chevron-right\"></i></a>\n"; |
|
| 363 | - $nav .= " (<a href=\"?year=" . $nowyear . "&month=" . $nowmonth . "&day=" . $nowday . $param . "\">" . $langs->trans("Today") . "</a>)";
|
|
| 362 | + $nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n"; |
|
| 363 | + $nav .= " (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
|
| 364 | 364 | $picto = 'calendarday'; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | // Must be after the nav definition |
| 368 | -$param .= '&year=' . $year . '&month=' . $month . ($day ? '&day=' . $day : ''); |
|
| 368 | +$param .= '&year='.$year.'&month='.$month.($day ? '&day='.$day : ''); |
|
| 369 | 369 | //print 'x'.$param; |
| 370 | 370 | |
| 371 | 371 | |
@@ -385,10 +385,10 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | $head = calendars_prepare_head($paramnoaction); |
| 387 | 387 | |
| 388 | -print '<form method="POST" id="searchFormList" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '">' . "\n"; |
|
| 388 | +print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n"; |
|
| 389 | 389 | if ($optioncss != '') |
| 390 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 391 | -print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 390 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 391 | +print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 392 | 392 | |
| 393 | 393 | dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
| 394 | 394 | print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid); |
@@ -402,50 +402,50 @@ discard block |
||
| 402 | 402 | $showextcals = $listofextcals; |
| 403 | 403 | |
| 404 | 404 | if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
| 405 | - $s .= "\n" . '<!-- Div to calendars selectors -->' . "\n"; |
|
| 406 | - $s .= '<script type="text/javascript">' . "\n"; |
|
| 407 | - $s .= 'jQuery(document).ready(function () {' . "\n";
|
|
| 408 | - $s .= 'jQuery("#check_birthday").click(function() { console.log("Toggle birthday"); jQuery(".family_birthday").toggle(); });' . "\n";
|
|
| 409 | - $s .= 'jQuery(".family_birthday").toggle();' . "\n";
|
|
| 405 | + $s .= "\n".'<!-- Div to calendars selectors -->'."\n"; |
|
| 406 | + $s .= '<script type="text/javascript">'."\n"; |
|
| 407 | + $s .= 'jQuery(document).ready(function () {'."\n";
|
|
| 408 | + $s .= 'jQuery("#check_birthday").click(function() { console.log("Toggle birthday"); jQuery(".family_birthday").toggle(); });'."\n";
|
|
| 409 | + $s .= 'jQuery(".family_birthday").toggle();'."\n";
|
|
| 410 | 410 | if ($action == "show_week" || $action == "show_month" || empty($action)) {
|
| 411 | 411 | // Code to enable drag and drop |
| 412 | - $s .= 'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {' . "\n";
|
|
| 412 | + $s .= 'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'."\n";
|
|
| 413 | 413 | // Code to submit form |
| 414 | - $s .= 'console.log("submit form to record new event");' . "\n";
|
|
| 414 | + $s .= 'console.log("submit form to record new event");'."\n";
|
|
| 415 | 415 | //$s.='console.log(event.target);'; |
| 416 | - $s .= 'var newval = jQuery(event.target).closest("div.dayevent").attr("id");' . "\n";
|
|
| 417 | - $s .= 'console.log("found parent div.dayevent with id = "+newval);' . "\n";
|
|
| 418 | - $s .= 'var frm=jQuery("#searchFormList");' . "\n";
|
|
| 419 | - $s .= 'var newurl = ui.item.find("a.cal_event").attr("href");' . "\n";
|
|
| 420 | - $s .= 'console.log(newurl);' . "\n"; |
|
| 421 | - $s .= 'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}' . "\n";
|
|
| 422 | - $s .= '});' . "\n"; |
|
| 416 | + $s .= 'var newval = jQuery(event.target).closest("div.dayevent").attr("id");'."\n";
|
|
| 417 | + $s .= 'console.log("found parent div.dayevent with id = "+newval);'."\n";
|
|
| 418 | + $s .= 'var frm=jQuery("#searchFormList");'."\n";
|
|
| 419 | + $s .= 'var newurl = ui.item.find("a.cal_event").attr("href");'."\n";
|
|
| 420 | + $s .= 'console.log(newurl);'."\n"; |
|
| 421 | + $s .= 'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'."\n";
|
|
| 422 | + $s .= '});'."\n"; |
|
| 423 | 423 | } |
| 424 | - $s .= '});' . "\n"; |
|
| 425 | - $s .= '</script>' . "\n"; |
|
| 424 | + $s .= '});'."\n"; |
|
| 425 | + $s .= '</script>'."\n"; |
|
| 426 | 426 | |
| 427 | 427 | // Local calendar |
| 428 | - $s .= '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda") . ' </div>';
|
|
| 428 | + $s .= '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' </div>';
|
|
| 429 | 429 | |
| 430 | 430 | // External calendars |
| 431 | 431 | if (is_array($showextcals) && count($showextcals) > 0) {
|
| 432 | - $s .= '<script type="text/javascript">' . "\n"; |
|
| 432 | + $s .= '<script type="text/javascript">'."\n"; |
|
| 433 | 433 | $s .= 'jQuery(document).ready(function () {
|
| 434 | 434 | jQuery("table input[name^=\"check_ext\"]").click(function() {
|
| 435 | 435 | var name = $(this).attr("name");
|
| 436 | 436 | jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
|
| 437 | 437 | }); |
| 438 | 438 | });' . "\n"; |
| 439 | - $s .= '</script>' . "\n"; |
|
| 439 | + $s .= '</script>'."\n"; |
|
| 440 | 440 | |
| 441 | 441 | foreach ($showextcals as $val) {
|
| 442 | 442 | $htmlname = md5($val['name']); |
| 443 | - $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked> ' . $val['name'] . ' </div>'; |
|
| 443 | + $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> '.$val['name'].' </div>'; |
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | // Birthdays |
| 448 | - $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_birthday" name="check_birthday"> ' . $langs->trans("AgendaShowBirthdayEvents") . ' </div>';
|
|
| 448 | + $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
|
| 449 | 449 | |
| 450 | 450 | // Calendars from hooks |
| 451 | 451 | $parameters = array(); |
@@ -457,12 +457,12 @@ discard block |
||
| 457 | 457 | $s = $hookmanager->resPrint; |
| 458 | 458 | } |
| 459 | 459 | } else { // If javascript off
|
| 460 | - $newparam = $param; // newparam is for birthday links |
|
| 461 | - $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday=' . (empty($showbirthday) ? 1 : 0), $newparam);
|
|
| 460 | + $newparam = $param; // newparam is for birthday links |
|
| 461 | + $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam);
|
|
| 462 | 462 | if (!preg_match('/showbirthday=/i', $newparam))
|
| 463 | 463 | $newparam .= '&showbirthday=1'; |
| 464 | - $link = '<a href="' . dol_escape_htmltag($_SERVER['PHP_SELF']); |
|
| 465 | - $link .= '?' . dol_escape_htmltag($newparam); |
|
| 464 | + $link = '<a href="'.dol_escape_htmltag($_SERVER['PHP_SELF']); |
|
| 465 | + $link .= '?'.dol_escape_htmltag($newparam); |
|
| 466 | 466 | $link .= '">'; |
| 467 | 467 | if (empty($showbirthday)) |
| 468 | 468 | $link .= $langs->trans("AgendaShowBirthdayEvents");
|
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | $link .= '</a>'; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | -print load_fiche_titre($s, $link . ' ' . $nav, '', 0, 0, 'tablelistofcalendars'); |
|
| 474 | +print load_fiche_titre($s, $link.' '.$nav, '', 0, 0, 'tablelistofcalendars'); |
|
| 475 | 475 | |
| 476 | 476 | |
| 477 | 477 | // Load events from database into $eventarray |
@@ -489,19 +489,19 @@ discard block |
||
| 489 | 489 | $sql .= ' a.fk_soc, a.fk_contact,'; |
| 490 | 490 | $sql .= ' a.fk_element, a.elementtype,'; |
| 491 | 491 | $sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color'; |
| 492 | -$sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_actioncomm as ca, ' . MAIN_DB_PREFIX . "actioncomm as a"; |
|
| 492 | +$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; |
|
| 493 | 493 | if (!$user->rights->societe->client->voir && !$socid) |
| 494 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 494 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 495 | 495 | // We must filter on resource table |
| 496 | 496 | if ($resourceid > 0) |
| 497 | - $sql .= ", " . MAIN_DB_PREFIX . "element_resources as r"; |
|
| 497 | + $sql .= ", ".MAIN_DB_PREFIX."element_resources as r"; |
|
| 498 | 498 | // We must filter on assignement table |
| 499 | 499 | if ($filtert > 0 || $usergroup > 0) |
| 500 | - $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 500 | + $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; |
|
| 501 | 501 | if ($usergroup > 0) |
| 502 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 502 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 503 | 503 | $sql .= ' WHERE a.fk_action = ca.id'; |
| 504 | -$sql .= ' AND a.entity IN (' . getEntity('agenda') . ')';
|
|
| 504 | +$sql .= ' AND a.entity IN ('.getEntity('agenda').')';
|
|
| 505 | 505 | // Condition on actioncode |
| 506 | 506 | if (!empty($actioncode)) {
|
| 507 | 507 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
@@ -523,50 +523,50 @@ discard block |
||
| 523 | 523 | $sql .= " AND ca.type = 'systemauto'"; |
| 524 | 524 | else {
|
| 525 | 525 | if (is_array($actioncode)) {
|
| 526 | - $sql .= " AND ca.code IN ('" . implode("','", $actioncode) . "')";
|
|
| 526 | + $sql .= " AND ca.code IN ('".implode("','", $actioncode)."')";
|
|
| 527 | 527 | } else {
|
| 528 | - $sql .= " AND ca.code IN ('" . implode("','", explode(',', $actioncode)) . "')";
|
|
| 528 | + $sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
|
|
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | if ($resourceid > 0) |
| 534 | - $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = " . $db->escape($resourceid); |
|
| 534 | + $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); |
|
| 535 | 535 | if ($pid) |
| 536 | - $sql .= " AND a.fk_project=" . $db->escape($pid); |
|
| 536 | + $sql .= " AND a.fk_project=".$db->escape($pid); |
|
| 537 | 537 | if (!$user->rights->societe->client->voir && !$socid) |
| 538 | - $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 538 | + $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")"; |
|
| 539 | 539 | if ($socid > 0) |
| 540 | - $sql .= ' AND a.fk_soc = ' . $socid; |
|
| 540 | + $sql .= ' AND a.fk_soc = '.$socid; |
|
| 541 | 541 | // We must filter on assignement table |
| 542 | 542 | if ($filtert > 0 || $usergroup > 0) |
| 543 | 543 | $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
| 544 | 544 | if ($action == 'show_day') {
|
| 545 | 545 | $sql .= " AND (";
|
| 546 | - $sql .= " (a.datep BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "'"; |
|
| 547 | - $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, $day, $year)) . "')"; |
|
| 546 | + $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; |
|
| 547 | + $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; |
|
| 548 | 548 | $sql .= " OR "; |
| 549 | - $sql .= " (a.datep2 BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "'"; |
|
| 550 | - $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, $day, $year)) . "')"; |
|
| 549 | + $sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; |
|
| 550 | + $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; |
|
| 551 | 551 | $sql .= " OR "; |
| 552 | - $sql .= " (a.datep < '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "'"; |
|
| 553 | - $sql .= " AND a.datep2 > '" . $db->idate(dol_mktime(23, 59, 59, $month, $day, $year)) . "')"; |
|
| 552 | + $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; |
|
| 553 | + $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; |
|
| 554 | 554 | $sql .= ')'; |
| 555 | 555 | } else {
|
| 556 | 556 | // To limit array |
| 557 | 557 | $sql .= " AND (";
|
| 558 | - $sql .= " (a.datep BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)) . "'"; // Start 7 days before |
|
| 559 | - $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)) . "')"; // End 7 days after + 3 to go from 28 to 31 |
|
| 558 | + $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before |
|
| 559 | + $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')"; // End 7 days after + 3 to go from 28 to 31 |
|
| 560 | 560 | $sql .= " OR "; |
| 561 | - $sql .= " (a.datep2 BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)) . "'"; |
|
| 562 | - $sql .= " AND '" . $db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)) . "')"; |
|
| 561 | + $sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; |
|
| 562 | + $sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')"; |
|
| 563 | 563 | $sql .= " OR "; |
| 564 | - $sql .= " (a.datep < '" . $db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7)) . "'"; |
|
| 565 | - $sql .= " AND a.datep2 > '" . $db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)) . "')"; |
|
| 564 | + $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; |
|
| 565 | + $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')"; |
|
| 566 | 566 | $sql .= ')'; |
| 567 | 567 | } |
| 568 | 568 | if ($type) |
| 569 | - $sql .= " AND ca.id = " . $type; |
|
| 569 | + $sql .= " AND ca.id = ".$type; |
|
| 570 | 570 | if ($status == '0') {
|
| 571 | 571 | $sql .= " AND a.percent = 0"; |
| 572 | 572 | } |
@@ -586,9 +586,9 @@ discard block |
||
| 586 | 586 | if ($filtert > 0 || $usergroup > 0) {
|
| 587 | 587 | $sql .= " AND (";
|
| 588 | 588 | if ($filtert > 0) |
| 589 | - $sql .= "ar.fk_element = " . $filtert; |
|
| 589 | + $sql .= "ar.fk_element = ".$filtert; |
|
| 590 | 590 | if ($usergroup > 0) |
| 591 | - $sql .= ($filtert > 0 ? " OR " : "") . " ugu.fk_usergroup = " . $usergroup; |
|
| 591 | + $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup; |
|
| 592 | 592 | $sql .= ")"; |
| 593 | 593 | } |
| 594 | 594 | // Sort on date |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | if ($resql) {
|
| 602 | 602 | $num = $db->num_rows($resql); |
| 603 | 603 | |
| 604 | - $MAXONSAMEPAGE = 10000; // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import) |
|
| 604 | + $MAXONSAMEPAGE = 10000; // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import) |
|
| 605 | 605 | $i = 0; |
| 606 | 606 | while ($i < $num && $i < $MAXONSAMEPAGE) {
|
| 607 | 607 | $obj = $db->fetch_object($resql); |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $event = new ActionComm($db); |
| 617 | 617 | $event->id = $obj->id; |
| 618 | 618 | |
| 619 | - $event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin |
|
| 619 | + $event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin |
|
| 620 | 620 | $event->datef = $db->jdate($obj->datep2); |
| 621 | 621 | //var_dump($obj->datep); |
| 622 | 622 | //var_dump($event->datep); |
@@ -628,9 +628,9 @@ discard block |
||
| 628 | 628 | $event->libelle = $obj->label; |
| 629 | 629 | $event->label = $obj->label; |
| 630 | 630 | $event->percentage = $obj->percent; |
| 631 | - $event->authorid = $obj->fk_user_author; // user id of creator |
|
| 631 | + $event->authorid = $obj->fk_user_author; // user id of creator |
|
| 632 | 632 | $event->userownerid = $obj->fk_user_action; // user id of owner |
| 633 | - $event->fetch_userassigned(); // This load $event->userassigned |
|
| 633 | + $event->fetch_userassigned(); // This load $event->userassigned |
|
| 634 | 634 | $event->priority = $obj->priority; |
| 635 | 635 | $event->fulldayevent = $obj->fulldayevent; |
| 636 | 636 | $event->location = $obj->location; |
@@ -710,14 +710,14 @@ discard block |
||
| 710 | 710 | if ($showbirthday) {
|
| 711 | 711 | // Add events in array |
| 712 | 712 | $sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday'; |
| 713 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'socpeople as sp'; |
|
| 714 | - $sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat=' . $user->id . '))'; |
|
| 715 | - $sql .= " AND sp.entity IN (" . getEntity('socpeople') . ")";
|
|
| 713 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp'; |
|
| 714 | + $sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.$user->id.'))'; |
|
| 715 | + $sql .= " AND sp.entity IN (".getEntity('socpeople').")";
|
|
| 716 | 716 | if ($action == 'show_day') {
|
| 717 | - $sql .= ' AND MONTH(birthday) = ' . $month; |
|
| 718 | - $sql .= ' AND DAY(birthday) = ' . $day; |
|
| 717 | + $sql .= ' AND MONTH(birthday) = '.$month; |
|
| 718 | + $sql .= ' AND DAY(birthday) = '.$day; |
|
| 719 | 719 | } else {
|
| 720 | - $sql .= ' AND MONTH(birthday) = ' . $month; |
|
| 720 | + $sql .= ' AND MONTH(birthday) = '.$month; |
|
| 721 | 721 | } |
| 722 | 722 | $sql .= ' ORDER BY birthday'; |
| 723 | 723 | |
@@ -733,10 +733,10 @@ discard block |
||
| 733 | 733 | $datebirth = dol_stringtotime($obj->birthday, 1); |
| 734 | 734 | //print 'ee'.$obj->birthday.'-'.$datebirth; |
| 735 | 735 | $datearray = dol_getdate($datebirth, true); |
| 736 | - $event->datep = dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true); // For full day events, date are also GMT but they wont but converted during output |
|
| 736 | + $event->datep = dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true); // For full day events, date are also GMT but they wont but converted during output |
|
| 737 | 737 | $event->datef = $event->datep; |
| 738 | 738 | $event->type_code = 'BIRTHDAY'; |
| 739 | - $event->libelle = $langs->trans("Birthday") . ' ' . dolGetFirstLastname($obj->firstname, $obj->lastname);
|
|
| 739 | + $event->libelle = $langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname);
|
|
| 740 | 740 | $event->percentage = 100; |
| 741 | 741 | $event->fulldayevent = 1; |
| 742 | 742 | |
@@ -769,9 +769,9 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | // Complete $eventarray with external import Ical |
| 771 | 771 | if (count($listofextcals)) {
|
| 772 | - require_once DOL_DOCUMENT_ROOT . '/comm/action/class/ical.class.php'; |
|
| 772 | + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/ical.class.php'; |
|
| 773 | 773 | foreach ($listofextcals as $extcal) {
|
| 774 | - $url = $extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics |
|
| 774 | + $url = $extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics |
|
| 775 | 775 | $namecal = $extcal['name']; |
| 776 | 776 | $offsettz = $extcal['offsettz']; |
| 777 | 777 | $colorcal = $extcal['color']; |
@@ -784,9 +784,9 @@ discard block |
||
| 784 | 784 | //var_dump($ical->cal); exit; |
| 785 | 785 | $icalevents = array(); |
| 786 | 786 | if (is_array($ical->get_event_list())) |
| 787 | - $icalevents = array_merge($icalevents, $ical->get_event_list()); // Add $ical->cal['VEVENT'] |
|
| 787 | + $icalevents = array_merge($icalevents, $ical->get_event_list()); // Add $ical->cal['VEVENT'] |
|
| 788 | 788 | if (is_array($ical->get_freebusy_list())) |
| 789 | - $icalevents = array_merge($icalevents, $ical->get_freebusy_list()); // Add $ical->cal['VFREEBUSY'] |
|
| 789 | + $icalevents = array_merge($icalevents, $ical->get_freebusy_list()); // Add $ical->cal['VFREEBUSY'] |
|
| 790 | 790 | |
| 791 | 791 | if (count($icalevents) > 0) {
|
| 792 | 792 | // Duplicate all repeatable events into new entries |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | //if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1); |
| 798 | 798 | if ($icalevent['DTSTART;VALUE=DATE']) { //fullday event
|
| 799 | 799 | $datecurstart = dol_stringtotime($icalevent['DTSTART;VALUE=DATE'], 1); |
| 800 | - $datecurend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day |
|
| 800 | + $datecurend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day |
|
| 801 | 801 | } else if (is_array($icalevent['DTSTART']) && !empty($icalevent['DTSTART']['unixtime'])) {
|
| 802 | 802 | $datecurstart = $icalevent['DTSTART']['unixtime']; |
| 803 | 803 | $datecurend = $icalevent['DTEND']['unixtime']; |
@@ -832,9 +832,9 @@ discard block |
||
| 832 | 832 | $until = empty($icalevent['RRULE']['UNTIL']) ? 0 : dol_stringtotime($icalevent['RRULE']['UNTIL'], 1); |
| 833 | 833 | $maxrepeat = empty($icalevent['RRULE']['COUNT']) ? 0 : $icalevent['RRULE']['COUNT']; |
| 834 | 834 | if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) |
| 835 | - continue; // We discard repeatable event that end before start date to show |
|
| 835 | + continue; // We discard repeatable event that end before start date to show |
|
| 836 | 836 | if ($datecurstart >= $lastdaytoshow) |
| 837 | - continue; // We discard repeatable event that start after end date to show |
|
| 837 | + continue; // We discard repeatable event that start after end date to show |
|
| 838 | 838 | |
| 839 | 839 | $numofevent = 0; |
| 840 | 840 | while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
|
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | } |
| 870 | 870 | // Test to avoid infinite loop ($datecurstart must increase) |
| 871 | 871 | if ($savdatecurstart >= $datecurstart) {
|
| 872 | - dol_syslog("Found a rule freq " . $icalevent['RRULE']['FREQ'] . " not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
|
|
| 872 | + dol_syslog("Found a rule freq ".$icalevent['RRULE']['FREQ']." not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
|
|
| 873 | 873 | $datecurstart += 3600 * 24 * 7; |
| 874 | 874 | $datecurend += 3600 * 24 * 7; |
| 875 | 875 | } |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | //var_dump($icalevent); |
| 884 | 884 | //print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit; |
| 885 | 885 | if (!empty($icalevent['RRULE'])) |
| 886 | - continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule. |
|
| 886 | + continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule. |
|
| 887 | 887 | |
| 888 | 888 | |
| 889 | 889 | |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | if (isset($icalevent['DTSTART;VALUE=DATE'])) { // fullday event
|
| 894 | 894 | // For full day events, date are also GMT but they wont but converted using tz during output |
| 895 | 895 | $datestart = dol_stringtotime($icalevent['DTSTART;VALUE=DATE'], 1); |
| 896 | - $dateend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day |
|
| 896 | + $dateend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day |
|
| 897 | 897 | //print 'x'.$datestart.'-'.$dateend;exit; |
| 898 | 898 | //print dol_print_date($dateend,'dayhour','gmt'); |
| 899 | 899 | $event->fulldayevent = 1; |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | $event->id = $icalevent['UID']; |
| 939 | 939 | $event->icalname = $namecal; |
| 940 | 940 | $event->icalcolor = $colorcal; |
| 941 | - $usertime = 0; // We dont modify date because we want to have date into memory datep and datef stored as GMT date. Compensation will be done during output. |
|
| 941 | + $usertime = 0; // We dont modify date because we want to have date into memory datep and datef stored as GMT date. Compensation will be done during output. |
|
| 942 | 942 | $event->datep = $datestart + $usertime; |
| 943 | 943 | $event->datef = $dateend + $usertime; |
| 944 | 944 | $event->type_code = "ICALEVENT"; |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | //if ($event->fulldayevent) print dol_print_date($daykeygmt,'dayhour','gmt').'-'.dol_print_date($daykey,'dayhour','gmt').'-'.dol_print_date($event->date_end_in_calendar,'dayhour','gmt').' '; |
| 992 | 992 | $eventarray[$daykey][] = $event; |
| 993 | 993 | $daykey += 60 * 60 * 24; |
| 994 | - $daykeygmt += 60 * 60 * 24; // Add one day |
|
| 994 | + $daykeygmt += 60 * 60 * 24; // Add one day |
|
| 995 | 995 | if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) |
| 996 | 996 | $loop = false; |
| 997 | 997 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | $cacheusers = array(); |
| 1027 | 1027 | |
| 1028 | 1028 | // Define theme_datacolor array |
| 1029 | -$color_file = DOL_DOCUMENT_ROOT . "/theme/" . $conf->theme . "/graph-color.php"; |
|
| 1029 | +$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; |
|
| 1030 | 1030 | if (is_readable($color_file)) {
|
| 1031 | 1031 | include_once $color_file; |
| 1032 | 1032 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | |
| 1037 | 1037 | if (empty($action) || $action == 'show_month') { // View by month
|
| 1038 | - $newparam = $param; // newparam is for birthday links |
|
| 1038 | + $newparam = $param; // newparam is for birthday links |
|
| 1039 | 1039 | $newparam = preg_replace('/showbirthday=/i', 'showbirthday_=', $newparam); // To avoid replacement when replace day= is done
|
| 1040 | 1040 | $newparam = preg_replace('/action=show_month&?/i', '', $newparam);
|
| 1041 | 1041 | $newparam = preg_replace('/action=show_week&?/i', '', $newparam);
|
@@ -1058,11 +1058,11 @@ discard block |
||
| 1058 | 1058 | $labelshort = array(0 => 'SundayMin', 1 => 'MondayMin', 2 => 'TuesdayMin', 3 => 'WednesdayMin', 4 => 'ThursdayMin', 5 => 'FridayMin', 6 => 'SaturdayMin'); |
| 1059 | 1059 | print $langs->trans($labelshort[$numdayinweek]); |
| 1060 | 1060 | } else |
| 1061 | - print $langs->trans("Day" . $numdayinweek);
|
|
| 1062 | - print ' </td>' . "\n"; |
|
| 1061 | + print $langs->trans("Day".$numdayinweek);
|
|
| 1062 | + print ' </td>'."\n"; |
|
| 1063 | 1063 | $i++; |
| 1064 | 1064 | } |
| 1065 | - echo ' </tr>' . "\n"; |
|
| 1065 | + echo ' </tr>'."\n"; |
|
| 1066 | 1066 | |
| 1067 | 1067 | $todayarray = dol_getdate($now, 'fast'); |
| 1068 | 1068 | $todaytms = dol_mktime(0, 0, 0, $todayarray['mon'], $todayarray['mday'], $todayarray['year']); |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | $style = 'cal_other_month cal_past'; |
| 1078 | 1078 | if ($iter_day == 6) |
| 1079 | 1079 | $style .= ' cal_other_month_right'; |
| 1080 | - echo ' <td class="' . $style . ' nowrap" width="14%" valign="top">'; |
|
| 1080 | + echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; |
|
| 1081 | 1081 | show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); |
| 1082 | 1082 | echo " </td>\n"; |
| 1083 | 1083 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | if ($curtime < $todaytms) |
| 1096 | 1096 | $style .= ' cal_past'; |
| 1097 | 1097 | //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style); |
| 1098 | - echo ' <td class="' . $style . ' nowrap" width="14%" valign="top">'; |
|
| 1098 | + echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; |
|
| 1099 | 1099 | show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); |
| 1100 | 1100 | echo " </td>\n"; |
| 1101 | 1101 | } |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | $style = 'cal_other_month'; |
| 1105 | 1105 | if ($iter_day == 6) |
| 1106 | 1106 | $style .= ' cal_other_month_right'; |
| 1107 | - echo ' <td class="' . $style . ' nowrap" width="14%" valign="top">'; |
|
| 1107 | + echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; |
|
| 1108 | 1108 | show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); |
| 1109 | 1109 | echo "</td>\n"; |
| 1110 | 1110 | } |
@@ -1116,11 +1116,11 @@ discard block |
||
| 1116 | 1116 | print '</div>'; |
| 1117 | 1117 | |
| 1118 | 1118 | print '<input type="hidden" name="actionmove" value="mupdate">'; |
| 1119 | - print '<input type="hidden" name="backtopage" value="' . dol_escape_htmltag($_SERVER['PHP_SELF']) . '?' . dol_escape_htmltag($_SERVER['QUERY_STRING']) . '">'; |
|
| 1119 | + print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER['PHP_SELF']).'?'.dol_escape_htmltag($_SERVER['QUERY_STRING']).'">'; |
|
| 1120 | 1120 | print '<input type="hidden" name="newdate" id="newdate">'; |
| 1121 | 1121 | } |
| 1122 | 1122 | elseif ($action == 'show_week') { // View by week
|
| 1123 | - $newparam = $param; // newparam is for birthday links |
|
| 1123 | + $newparam = $param; // newparam is for birthday links |
|
| 1124 | 1124 | $newparam = preg_replace('/showbirthday=/i', 'showbirthday_=', $newparam); // To avoid replacement when replace day= is done
|
| 1125 | 1125 | $newparam = preg_replace('/action=show_month&?/i', '', $newparam);
|
| 1126 | 1126 | $newparam = preg_replace('/action=show_week&?/i', '', $newparam);
|
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | print ' <tr class="liste_titre">'; |
| 1137 | 1137 | $i = 0; |
| 1138 | 1138 | while ($i < 7) {
|
| 1139 | - echo ' <td align="center">' . $langs->trans("Day" . (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7)) . "</td>\n";
|
|
| 1139 | + echo ' <td align="center">'.$langs->trans("Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7))."</td>\n";
|
|
| 1140 | 1140 | $i++; |
| 1141 | 1141 | } |
| 1142 | 1142 | echo " </tr>\n"; |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | if ($today) |
| 1162 | 1162 | $style = 'cal_today'; |
| 1163 | 1163 | |
| 1164 | - echo ' <td class="' . $style . '" width="14%" valign="top">'; |
|
| 1164 | + echo ' <td class="'.$style.'" width="14%" valign="top">'; |
|
| 1165 | 1165 | show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); |
| 1166 | 1166 | echo " </td>\n"; |
| 1167 | 1167 | } |
@@ -1171,11 +1171,11 @@ discard block |
||
| 1171 | 1171 | print '</div>'; |
| 1172 | 1172 | |
| 1173 | 1173 | echo '<input type="hidden" name="actionmove" value="mupdate">'; |
| 1174 | - echo '<input type="hidden" name="backtopage" value="' . dol_escape_htmltag($_SERVER['PHP_SELF']) . '?' . dol_escape_htmltag($_SERVER['QUERY_STRING']) . '">'; |
|
| 1174 | + echo '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER['PHP_SELF']).'?'.dol_escape_htmltag($_SERVER['QUERY_STRING']).'">'; |
|
| 1175 | 1175 | echo '<input type="hidden" name="newdate" id="newdate">'; |
| 1176 | 1176 | } |
| 1177 | 1177 | else { // View by day
|
| 1178 | - $newparam = $param; // newparam is for birthday links |
|
| 1178 | + $newparam = $param; // newparam is for birthday links |
|
| 1179 | 1179 | $newparam = preg_replace('/action=show_month&?/i', '', $newparam);
|
| 1180 | 1180 | $newparam = preg_replace('/action=show_week&?/i', '', $newparam);
|
| 1181 | 1181 | $newparam = preg_replace('/viewday=[0-9]+&?/i', '', $newparam);
|
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | |
| 1197 | 1197 | echo ' <tr class="tagtr liste_titre">'; |
| 1198 | 1198 | echo ' <td class="tagtd width100"></td>'; |
| 1199 | - echo ' <td class="tagtd center">' . $langs->trans("Day" . $arraytimestamp['wday']) . "</td>\n";
|
|
| 1199 | + echo ' <td class="tagtd center">'.$langs->trans("Day".$arraytimestamp['wday'])."</td>\n";
|
|
| 1200 | 1200 | echo " </td>\n"; |
| 1201 | 1201 | |
| 1202 | 1202 | /* |
@@ -1213,11 +1213,11 @@ discard block |
||
| 1213 | 1213 | /* WIP View per hour */ |
| 1214 | 1214 | $useviewhour = 0; |
| 1215 | 1215 | if ($useviewhour) {
|
| 1216 | - print '<div class="div-table-responsive-no-min borderbottom">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table |
|
| 1216 | + print '<div class="div-table-responsive-no-min borderbottom">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table |
|
| 1217 | 1217 | |
| 1218 | 1218 | $maxheightwin = (isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500) ? ($_SESSION["dol_screenheight"] - 200) : 660; // Also into index.php file |
| 1219 | 1219 | |
| 1220 | - echo '<div style="max-height: ' . $maxheightwin . 'px;">'; |
|
| 1220 | + echo '<div style="max-height: '.$maxheightwin.'px;">'; |
|
| 1221 | 1221 | echo '<div class="tagtable centpercent calendarviewcontainer">'; |
| 1222 | 1222 | |
| 1223 | 1223 | $maxnbofchar = 80; |
@@ -1236,9 +1236,9 @@ discard block |
||
| 1236 | 1236 | $i = 0; |
| 1237 | 1237 | $j = 0; |
| 1238 | 1238 | while ($i < 24) {
|
| 1239 | - echo ' <div class="tagtr calendarviewcontainertr">' . "\n"; |
|
| 1240 | - echo ' <div class="tagtd width100 tdtop">' . dol_print_date($i * 3600, 'hour', 'gmt') . '</div>'; |
|
| 1241 | - echo ' <div class="tagtd ' . $style . ' tdtop">'; |
|
| 1239 | + echo ' <div class="tagtr calendarviewcontainertr">'."\n"; |
|
| 1240 | + echo ' <div class="tagtd width100 tdtop">'.dol_print_date($i * 3600, 'hour', 'gmt').'</div>'; |
|
| 1241 | + echo ' <div class="tagtd '.$style.' tdtop">'; |
|
| 1242 | 1242 | echo " </div>\n"; |
| 1243 | 1243 | echo " </div>\n"; |
| 1244 | 1244 | $i++; |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | |
| 1252 | 1252 | print '</div>'; |
| 1253 | 1253 | } else {
|
| 1254 | - print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table |
|
| 1254 | + print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table |
|
| 1255 | 1255 | |
| 1256 | 1256 | show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0); |
| 1257 | 1257 | |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | } |
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | -print "\n" . '</form>'; |
|
| 1262 | +print "\n".'</form>'; |
|
| 1263 | 1263 | |
| 1264 | 1264 | // End of page |
| 1265 | 1265 | llxFooter(); |
@@ -1290,18 +1290,18 @@ discard block |
||
| 1290 | 1290 | global $theme_datacolor; |
| 1291 | 1291 | global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; |
| 1292 | 1292 | |
| 1293 | - $dateint = sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day);
|
|
| 1293 | + $dateint = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
|
|
| 1294 | 1294 | |
| 1295 | 1295 | print "\n"; |
| 1296 | 1296 | |
| 1297 | 1297 | // Line with title of day |
| 1298 | 1298 | $curtime = dol_mktime(0, 0, 0, $month, $day, $year); |
| 1299 | - print '<div id="dayevent_' . $dateint . '" class="dayevent tagtable centpercent nobordernopadding">' . "\n"; |
|
| 1299 | + print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding">'."\n"; |
|
| 1300 | 1300 | |
| 1301 | 1301 | if ($nonew <= 0) {
|
| 1302 | 1302 | print '<div class="tagtr"><div class="nowrap float">'; |
| 1303 | - print '<a style="color: #666" href="' . DOL_URL_ROOT . '/comm/action/index.php?'; |
|
| 1304 | - print 'action=show_day&day=' . str_pad($day, 2, "0", STR_PAD_LEFT) . '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year; |
|
| 1303 | + print '<a style="color: #666" href="'.DOL_URL_ROOT.'/comm/action/index.php?'; |
|
| 1304 | + print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; |
|
| 1305 | 1305 | print $newparam; |
| 1306 | 1306 | print '">'; |
| 1307 | 1307 | if ($showinfo) |
@@ -1311,15 +1311,15 @@ discard block |
||
| 1311 | 1311 | print '</a>'; |
| 1312 | 1312 | print '</div><div class="floatright nowrap">'; |
| 1313 | 1313 | if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
|
| 1314 | - $newparam .= '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year; |
|
| 1314 | + $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; |
|
| 1315 | 1315 | |
| 1316 | 1316 | //$param='month='.$monthshown.'&year='.$year; |
| 1317 | 1317 | $hourminsec = '100000'; |
| 1318 | - print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&datep=' . sprintf("%04d%02d%02d", $year, $month, $day) . $hourminsec . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . ($newparam ? '?' . $newparam : '')) . '">';
|
|
| 1318 | + print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $year, $month, $day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')).'">';
|
|
| 1319 | 1319 | print img_picto($langs->trans("NewAction"), 'edit_add.png');
|
| 1320 | 1320 | print '</a>'; |
| 1321 | 1321 | } |
| 1322 | - print '</div></div>' . "\n"; |
|
| 1322 | + print '</div></div>'."\n"; |
|
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | if ($nonew < 0) {
|
@@ -1337,9 +1337,9 @@ discard block |
||
| 1337 | 1337 | $numbirthday = 0; |
| 1338 | 1338 | $numical = 0; |
| 1339 | 1339 | $numicals = array(); |
| 1340 | - $ymd = sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day);
|
|
| 1340 | + $ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
|
|
| 1341 | 1341 | |
| 1342 | - $colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0 |
|
| 1342 | + $colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0 |
|
| 1343 | 1343 | $nextindextouse = is_array($colorindexused) ? count($colorindexused) : 0; // At first run this is 0, so fist user has 0, next 1, ... |
| 1344 | 1344 | //var_dump($colorindexused); |
| 1345 | 1345 | |
@@ -1376,11 +1376,11 @@ discard block |
||
| 1376 | 1376 | if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
|
| 1377 | 1377 | $numicals[dol_string_nospecial($event->icalname)] = 0; |
| 1378 | 1378 | } |
| 1379 | - $numicals[dol_string_nospecial($event->icalname)] ++; |
|
| 1379 | + $numicals[dol_string_nospecial($event->icalname)]++; |
|
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | 1382 | $color = ($event->icalcolor ? $event->icalcolor : -1); |
| 1383 | - $cssclass = (!empty($event->icalname) ? 'family_ext' . md5($event->icalname) : 'family_other'); |
|
| 1383 | + $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); |
|
| 1384 | 1384 | } else if ($event->type_code == 'BIRTHDAY') {
|
| 1385 | 1385 | $numbirthday++; |
| 1386 | 1386 | $colorindex = 2; |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | } else {
|
| 1390 | 1390 | $numother++; |
| 1391 | 1391 | $color = ($event->icalcolor ? $event->icalcolor : -1); |
| 1392 | - $cssclass = (!empty($event->icalname) ? 'family_ext' . md5($event->icalname) : 'family_other'); |
|
| 1392 | + $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); |
|
| 1393 | 1393 | |
| 1394 | 1394 | if (empty($cacheusers[$event->userownerid])) {
|
| 1395 | 1395 | $newuser = new User($db); |
@@ -1417,7 +1417,7 @@ discard block |
||
| 1417 | 1417 | // Define color |
| 1418 | 1418 | $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
|
| 1419 | 1419 | } |
| 1420 | - $cssclass = $cssclass . ' ' . $cssclass . '_day_' . $ymd; |
|
| 1420 | + $cssclass = $cssclass.' '.$cssclass.'_day_'.$ymd; |
|
| 1421 | 1421 | |
| 1422 | 1422 | // Defined style to disable drag and drop feature |
| 1423 | 1423 | if ($event->type_code == 'AC_OTH_AUTO') {
|
@@ -1453,8 +1453,8 @@ discard block |
||
| 1453 | 1453 | |
| 1454 | 1454 | // Show rect of event |
| 1455 | 1455 | print "\n"; |
| 1456 | - print '<!-- start event ' . $i . ' -->' . "\n"; |
|
| 1457 | - print '<div id="event_' . $ymd . '_' . $i . '" class="event ' . $cssclass . '"'; |
|
| 1456 | + print '<!-- start event '.$i.' -->'."\n"; |
|
| 1457 | + print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"'; |
|
| 1458 | 1458 | //print ' style="height: 100px;'; |
| 1459 | 1459 | //print ' position: absolute; top: 40px; width: 50%;'; |
| 1460 | 1460 | //print '"'; |
@@ -1462,12 +1462,12 @@ discard block |
||
| 1462 | 1462 | |
| 1463 | 1463 | //var_dump($event->userassigned); |
| 1464 | 1464 | //var_dump($event->transparency); |
| 1465 | - print '<table class="centpercent cal_event' . (empty($event->transparency) ? ' cal_event_notbusy' : ' cal_event_busy') . '" style="' . $h; |
|
| 1465 | + print '<table class="centpercent cal_event'.(empty($event->transparency) ? ' cal_event_notbusy' : ' cal_event_busy').'" style="'.$h; |
|
| 1466 | 1466 | if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) {
|
| 1467 | - print 'border: 2px solid #' . $color . ';'; |
|
| 1467 | + print 'border: 2px solid #'.$color.';'; |
|
| 1468 | 1468 | } else {
|
| 1469 | - print 'background: #' . $color . ';'; |
|
| 1470 | - print 'background: -webkit-gradient(linear, left top, left bottom, from(#' . dol_color_minus($color, -3) . '), to(#' . dol_color_minus($color, -1) . '));'; |
|
| 1469 | + print 'background: #'.$color.';'; |
|
| 1470 | + print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($color, -3).'), to(#'.dol_color_minus($color, -1).'));'; |
|
| 1471 | 1471 | } |
| 1472 | 1472 | //if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));'; |
| 1473 | 1473 | //else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;'; |
@@ -1475,7 +1475,7 @@ discard block |
||
| 1475 | 1475 | //print 'border: 1px solid #ccc" width="100%"'; |
| 1476 | 1476 | print '">'; |
| 1477 | 1477 | print '<tr>'; |
| 1478 | - print '<td class="tdoverflow nobottom centpercent ' . ($nowrapontd ? 'nowrap ' : '') . 'cal_event' . ($event->type_code == 'BIRTHDAY' ? ' cal_event_birthday' : '') . '">'; |
|
| 1478 | + print '<td class="tdoverflow nobottom centpercent '.($nowrapontd ? 'nowrap ' : '').'cal_event'.($event->type_code == 'BIRTHDAY' ? ' cal_event_birthday' : '').'">'; |
|
| 1479 | 1479 | |
| 1480 | 1480 | $daterange = ''; |
| 1481 | 1481 | |
@@ -1520,13 +1520,13 @@ discard block |
||
| 1520 | 1520 | } |
| 1521 | 1521 | else {
|
| 1522 | 1522 | if ($showinfo) {
|
| 1523 | - print $langs->trans("EventOnFullDay") . "<br>\n";
|
|
| 1523 | + print $langs->trans("EventOnFullDay")."<br>\n";
|
|
| 1524 | 1524 | } |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | 1527 | // Show title |
| 1528 | 1528 | $titletoshow = $daterange; |
| 1529 | - $titletoshow .= ($titletoshow ? ' ' : '') . $event->libelle; |
|
| 1529 | + $titletoshow .= ($titletoshow ? ' ' : '').$event->libelle; |
|
| 1530 | 1530 | |
| 1531 | 1531 | if ($event->type_code == 'ICALEVENT') |
| 1532 | 1532 | print $titletoshow; |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | print $listofusertoshow; |
| 1558 | 1558 | |
| 1559 | 1559 | if ($event->type_code == 'ICALEVENT') |
| 1560 | - print '<br>(' . dol_trunc($event->icalname, $maxnbofchar) . ')';
|
|
| 1560 | + print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
|
|
| 1561 | 1561 | |
| 1562 | 1562 | // If action related to company / contact |
| 1563 | 1563 | $linerelatedto = ''; |
@@ -1584,20 +1584,20 @@ discard block |
||
| 1584 | 1584 | $linerelatedto .= $contact->getNomUrl(1, '', 0); |
| 1585 | 1585 | } |
| 1586 | 1586 | if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && !empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) {
|
| 1587 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 1587 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 1588 | 1588 | if ($linerelatedto) |
| 1589 | 1589 | $linerelatedto .= '<br>'; |
| 1590 | 1590 | $linerelatedto .= dolGetElementUrl($event->fk_element, $event->elementtype, 1); |
| 1591 | 1591 | } |
| 1592 | 1592 | if ($linerelatedto) |
| 1593 | - print '<br>' . $linerelatedto; |
|
| 1593 | + print '<br>'.$linerelatedto; |
|
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | 1596 | // Show location |
| 1597 | 1597 | if ($showinfo) {
|
| 1598 | 1598 | if ($event->location) {
|
| 1599 | 1599 | print '<br>'; |
| 1600 | - print $langs->trans("Location") . ': ' . $event->location;
|
|
| 1600 | + print $langs->trans("Location").': '.$event->location;
|
|
| 1601 | 1601 | } |
| 1602 | 1602 | } |
| 1603 | 1603 | |
@@ -1609,23 +1609,23 @@ discard block |
||
| 1609 | 1609 | if ($event->percentage >= 0) |
| 1610 | 1610 | $withstatus = 2; |
| 1611 | 1611 | } |
| 1612 | - print '<td class="nobottom right nowrap cal_event_right' . ($withstatus >= 2 ? ' cal_event_right_status' : '') . '">'; |
|
| 1612 | + print '<td class="nobottom right nowrap cal_event_right'.($withstatus >= 2 ? ' cal_event_right_status' : '').'">'; |
|
| 1613 | 1613 | if ($withstatus) |
| 1614 | 1614 | print $event->getLibStatut(3, 1); |
| 1615 | 1615 | else |
| 1616 | 1616 | print ' '; |
| 1617 | 1617 | print '</td></tr></table>'; |
| 1618 | - print '</div><!-- end event ' . $i . ' -->' . "\n"; |
|
| 1618 | + print '</div><!-- end event '.$i.' -->'."\n"; |
|
| 1619 | 1619 | $i++; |
| 1620 | 1620 | } |
| 1621 | 1621 | else {
|
| 1622 | - print '<a href="' . DOL_URL_ROOT . '/comm/action/index.php?action=' . $action . '&maxprint=0&month=' . $monthshown . '&year=' . $year; |
|
| 1623 | - print ($status ? '&status=' . $status : '') . ($filter ? '&filter=' . $filter : ''); |
|
| 1624 | - print ($filtert ? '&filtert=' . $filtert : ''); |
|
| 1625 | - print ($usergroup ? '&usergroup=' . $usergroup : ''); |
|
| 1626 | - print ($actioncode != '' ? '&actioncode=' . $actioncode : ''); |
|
| 1627 | - print '">' . img_picto("all", "1downarrow_selected.png") . ' ...';
|
|
| 1628 | - print ' +' . (count($eventarray[$daykey]) - $maxprint); |
|
| 1622 | + print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year; |
|
| 1623 | + print ($status ? '&status='.$status : '').($filter ? '&filter='.$filter : ''); |
|
| 1624 | + print ($filtert ? '&filtert='.$filtert : ''); |
|
| 1625 | + print ($usergroup ? '&usergroup='.$usergroup : ''); |
|
| 1626 | + print ($actioncode != '' ? '&actioncode='.$actioncode : ''); |
|
| 1627 | + print '">'.img_picto("all", "1downarrow_selected.png").' ...';
|
|
| 1628 | + print ' +'.(count($eventarray[$daykey]) - $maxprint); |
|
| 1629 | 1629 | print '</a>'; |
| 1630 | 1630 | break; |
| 1631 | 1631 | //$ok=false; // To avoid to show twice the link |
@@ -1639,26 +1639,26 @@ discard block |
||
| 1639 | 1639 | print ' '; |
| 1640 | 1640 | |
| 1641 | 1641 | if (!empty($conf->global->MAIN_JS_SWITCH_AGENDA) && $i > $maxprint && $maxprint) {
|
| 1642 | - print '<div id="more_' . $ymd . '">' . img_picto("all", "1downarrow_selected.png") . ' +' . $langs->trans("More") . '...</div>';
|
|
| 1642 | + print '<div id="more_'.$ymd.'">'.img_picto("all", "1downarrow_selected.png").' +'.$langs->trans("More").'...</div>';
|
|
| 1643 | 1643 | //print ' +'.(count($eventarray[$daykey])-$maxprint); |
| 1644 | - print '<script type="text/javascript">' . "\n"; |
|
| 1645 | - print 'jQuery(document).ready(function () {' . "\n";
|
|
| 1646 | - print 'jQuery("#more_' . $ymd . '").click(function() { reinit_day_' . $ymd . '(); });' . "\n";
|
|
| 1644 | + print '<script type="text/javascript">'."\n"; |
|
| 1645 | + print 'jQuery(document).ready(function () {'."\n";
|
|
| 1646 | + print 'jQuery("#more_'.$ymd.'").click(function() { reinit_day_'.$ymd.'(); });'."\n";
|
|
| 1647 | 1647 | |
| 1648 | - print 'function reinit_day_' . $ymd . '() {' . "\n";
|
|
| 1649 | - print 'var nb=0;' . "\n"; |
|
| 1648 | + print 'function reinit_day_'.$ymd.'() {'."\n";
|
|
| 1649 | + print 'var nb=0;'."\n"; |
|
| 1650 | 1650 | // TODO Loop on each element of day $ymd and start to toggle once $maxprint has been reached |
| 1651 | - print 'jQuery(".family_mytasks_day_' . $ymd . '").toggle();';
|
|
| 1652 | - print '}' . "\n"; |
|
| 1651 | + print 'jQuery(".family_mytasks_day_'.$ymd.'").toggle();';
|
|
| 1652 | + print '}'."\n"; |
|
| 1653 | 1653 | |
| 1654 | - print '});' . "\n"; |
|
| 1654 | + print '});'."\n"; |
|
| 1655 | 1655 | |
| 1656 | - print '</script>' . "\n"; |
|
| 1656 | + print '</script>'."\n"; |
|
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | - print '</div></div>'; // td tr |
|
| 1659 | + print '</div></div>'; // td tr |
|
| 1660 | 1660 | |
| 1661 | - print '</div>'; // table |
|
| 1661 | + print '</div>'; // table |
|
| 1662 | 1662 | print "\n"; |
| 1663 | 1663 | } |
| 1664 | 1664 | |
@@ -43,11 +43,13 @@ discard block |
||
| 43 | 43 | require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) |
|
| 47 | - $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3; |
|
| 46 | +if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) { |
|
| 47 | + $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3; |
|
| 48 | +} |
|
| 48 | 49 | |
| 49 | -if (empty($conf->global->AGENDA_EXT_NB)) |
|
| 50 | - $conf->global->AGENDA_EXT_NB = 5; |
|
| 50 | +if (empty($conf->global->AGENDA_EXT_NB)) { |
|
| 51 | + $conf->global->AGENDA_EXT_NB = 5; |
|
| 52 | +} |
|
| 51 | 53 | $MAXAGENDA = $conf->global->AGENDA_EXT_NB; |
| 52 | 54 | |
| 53 | 55 | $filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
@@ -68,24 +70,30 @@ discard block |
||
| 68 | 70 | } // If $page is not defined, or '' or -1 |
| 69 | 71 | $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
| 70 | 72 | $offset = $limit * $page; |
| 71 | -if (!$sortorder) |
|
| 72 | - $sortorder = "ASC"; |
|
| 73 | -if (!$sortfield) |
|
| 74 | - $sortfield = "a.datec"; |
|
| 73 | +if (!$sortorder) { |
|
| 74 | + $sortorder = "ASC"; |
|
| 75 | +} |
|
| 76 | +if (!$sortfield) { |
|
| 77 | + $sortfield = "a.datec"; |
|
| 78 | +} |
|
| 75 | 79 | |
| 76 | 80 | // Security check |
| 77 | 81 | $socid = GETPOST("search_socid", "int") ? GETPOST("search_socid", "int") : GETPOST("socid", "int");
|
| 78 | -if ($user->societe_id) |
|
| 79 | - $socid = $user->societe_id; |
|
| 82 | +if ($user->societe_id) { |
|
| 83 | + $socid = $user->societe_id; |
|
| 84 | +} |
|
| 80 | 85 | $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); |
| 81 | -if ($socid < 0) |
|
| 82 | - $socid = ''; |
|
| 86 | +if ($socid < 0) { |
|
| 87 | + $socid = ''; |
|
| 88 | +} |
|
| 83 | 89 | |
| 84 | 90 | $canedit = 1; |
| 85 | -if (!$user->rights->agenda->myactions->read) |
|
| 86 | - accessforbidden(); |
|
| 87 | -if (!$user->rights->agenda->allactions->read) |
|
| 88 | - $canedit = 0; |
|
| 91 | +if (!$user->rights->agenda->myactions->read) { |
|
| 92 | + accessforbidden(); |
|
| 93 | +} |
|
| 94 | +if (!$user->rights->agenda->allactions->read) { |
|
| 95 | + $canedit = 0; |
|
| 96 | +} |
|
| 89 | 97 | if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
| 90 | 98 | $filtert = $user->id; |
| 91 | 99 | } |
@@ -103,22 +111,25 @@ discard block |
||
| 103 | 111 | // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) |
| 104 | 112 | if (GETPOST('search_actioncode', 'array')) {
|
| 105 | 113 | $actioncode = GETPOST('search_actioncode', 'array', 3);
|
| 106 | - if (!count($actioncode)) |
|
| 107 | - $actioncode = '0'; |
|
| 108 | -} |
|
| 109 | -else {
|
|
| 114 | + if (!count($actioncode)) { |
|
| 115 | + $actioncode = '0'; |
|
| 116 | + } |
|
| 117 | + } else {
|
|
| 110 | 118 | $actioncode = GETPOST("search_actioncode", "alpha", 3) ? GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
| 111 | 119 | } |
| 112 | -if ($actioncode == '' && empty($actioncodearray)) |
|
| 113 | - $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); |
|
| 120 | +if ($actioncode == '' && empty($actioncodearray)) { |
|
| 121 | + $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); |
|
| 122 | +} |
|
| 114 | 123 | |
| 115 | -if ($status == '' && !GETPOSTISSET('search_status'))
|
|
| 116 | - $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); |
|
| 124 | +if ($status == '' && !GETPOSTISSET('search_status')) { |
|
| 125 | + $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); |
|
| 126 | +} |
|
| 117 | 127 | |
| 118 | 128 | $defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); |
| 119 | 129 | $defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW); |
| 120 | -if (empty($action) && !GETPOSTISSET('action'))
|
|
| 121 | - $action = $defaultview; |
|
| 130 | +if (empty($action) && !GETPOSTISSET('action')) { |
|
| 131 | + $action = $defaultview; |
|
| 132 | +} |
|
| 122 | 133 | if ($action == 'default') { // When action is default, we want a calendar view and not the list
|
| 123 | 134 | $action = (($defaultview != 'show_list') ? $defaultview : 'show_month'); |
| 124 | 135 | } |
@@ -150,8 +161,9 @@ discard block |
||
| 150 | 161 | $param = ''; |
| 151 | 162 | if (is_array($_POST)) {
|
| 152 | 163 | foreach ($_POST as $key => $val) {
|
| 153 | - if ($key == 'token') |
|
| 154 | - continue; |
|
| 164 | + if ($key == 'token') { |
|
| 165 | + continue; |
|
| 166 | + } |
|
| 155 | 167 | $param .= '&' . $key . '=' . urlencode($val); |
| 156 | 168 | } |
| 157 | 169 | } |
@@ -164,8 +176,9 @@ discard block |
||
| 164 | 176 | $param = ''; |
| 165 | 177 | if (is_array($_POST)) {
|
| 166 | 178 | foreach ($_POST as $key => $val) {
|
| 167 | - if ($key == 'token') |
|
| 168 | - continue; |
|
| 179 | + if ($key == 'token') { |
|
| 180 | + continue; |
|
| 181 | + } |
|
| 169 | 182 | $param .= '&' . $key . '=' . urlencode($val); |
| 170 | 183 | } |
| 171 | 184 | } |
@@ -247,15 +260,18 @@ discard block |
||
| 247 | 260 | // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) |
| 248 | 261 | $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday
|
| 249 | 262 | $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); |
| 250 | - if ($tmpday >= 1) |
|
| 251 | - $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. |
|
| 263 | + if ($tmpday >= 1) { |
|
| 264 | + $tmpday -= 7; |
|
| 265 | + } |
|
| 266 | + // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. |
|
| 252 | 267 | |
| 253 | 268 | |
| 254 | 269 | // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) |
| 255 | 270 | $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year); |
| 256 | 271 | $next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7; |
| 257 | - if ($next_day < 6) |
|
| 258 | - $next_day += 7; |
|
| 272 | + if ($next_day < 6) { |
|
| 273 | + $next_day += 7; |
|
| 274 | + } |
|
| 259 | 275 | $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year); |
| 260 | 276 | } |
| 261 | 277 | if ($action == 'show_week') {
|
@@ -303,39 +319,53 @@ discard block |
||
| 303 | 319 | //print dol_print_date($lastdaytoshow,'day'); |
| 304 | 320 | |
| 305 | 321 | $title = $langs->trans("DoneAndToDoActions");
|
| 306 | -if ($status == 'done') |
|
| 307 | - $title = $langs->trans("DoneActions");
|
|
| 308 | -if ($status == 'todo') |
|
| 309 | - $title = $langs->trans("ToDoActions");
|
|
| 322 | +if ($status == 'done') { |
|
| 323 | + $title = $langs->trans("DoneActions"); |
|
| 324 | +} |
|
| 325 | +if ($status == 'todo') { |
|
| 326 | + $title = $langs->trans("ToDoActions"); |
|
| 327 | +} |
|
| 310 | 328 | |
| 311 | 329 | $param = ''; |
| 312 | 330 | if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) {
|
| 313 | 331 | if (is_array($actioncode)) {
|
| 314 | - foreach ($actioncode as $str_action) |
|
| 315 | - $param .= "&search_actioncode[]=" . urlencode($str_action); |
|
| 316 | - } else |
|
| 317 | - $param .= "&search_actioncode=" . urlencode($actioncode); |
|
| 318 | -} |
|
| 319 | -if ($resourceid > 0) |
|
| 320 | - $param .= "&search_resourceid=" . urlencode($resourceid); |
|
| 321 | -if ($status || isset($_GET['status']) || isset($_POST['status'])) |
|
| 322 | - $param .= "&search_status=" . urlencode($status); |
|
| 323 | -if ($filter) |
|
| 324 | - $param .= "&search_filter=" . urlencode($filter); |
|
| 325 | -if ($filtert) |
|
| 326 | - $param .= "&search_filtert=" . urlencode($filtert); |
|
| 327 | -if ($usergroup) |
|
| 328 | - $param .= "&search_usergroup=" . urlencode($usergroup); |
|
| 329 | -if ($socid) |
|
| 330 | - $param .= "&search_socid=" . urlencode($socid); |
|
| 331 | -if ($showbirthday) |
|
| 332 | - $param .= "&search_showbirthday=1"; |
|
| 333 | -if ($pid) |
|
| 334 | - $param .= "&search_projectid=" . urlencode($pid); |
|
| 335 | -if ($type) |
|
| 336 | - $param .= "&search_type=" . urlencode($type); |
|
| 337 | -if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') |
|
| 338 | - $param .= '&action=' . urlencode($action); |
|
| 332 | + foreach ($actioncode as $str_action) { |
|
| 333 | + $param .= "&search_actioncode[]=" . urlencode($str_action); |
|
| 334 | + } |
|
| 335 | + } else { |
|
| 336 | + $param .= "&search_actioncode=" . urlencode($actioncode); |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | +if ($resourceid > 0) { |
|
| 340 | + $param .= "&search_resourceid=" . urlencode($resourceid); |
|
| 341 | +} |
|
| 342 | +if ($status || isset($_GET['status']) || isset($_POST['status'])) { |
|
| 343 | + $param .= "&search_status=" . urlencode($status); |
|
| 344 | +} |
|
| 345 | +if ($filter) { |
|
| 346 | + $param .= "&search_filter=" . urlencode($filter); |
|
| 347 | +} |
|
| 348 | +if ($filtert) { |
|
| 349 | + $param .= "&search_filtert=" . urlencode($filtert); |
|
| 350 | +} |
|
| 351 | +if ($usergroup) { |
|
| 352 | + $param .= "&search_usergroup=" . urlencode($usergroup); |
|
| 353 | +} |
|
| 354 | +if ($socid) { |
|
| 355 | + $param .= "&search_socid=" . urlencode($socid); |
|
| 356 | +} |
|
| 357 | +if ($showbirthday) { |
|
| 358 | + $param .= "&search_showbirthday=1"; |
|
| 359 | +} |
|
| 360 | +if ($pid) { |
|
| 361 | + $param .= "&search_projectid=" . urlencode($pid); |
|
| 362 | +} |
|
| 363 | +if ($type) { |
|
| 364 | + $param .= "&search_type=" . urlencode($type); |
|
| 365 | +} |
|
| 366 | +if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') { |
|
| 367 | + $param .= '&action=' . urlencode($action); |
|
| 368 | +} |
|
| 339 | 369 | $param .= "&maxprint=" . urlencode($maxprint); |
| 340 | 370 | |
| 341 | 371 | // Show navigation bar |
@@ -372,22 +402,27 @@ discard block |
||
| 372 | 402 | |
| 373 | 403 | |
| 374 | 404 | $tabactive = ''; |
| 375 | -if ($action == 'show_month') |
|
| 376 | - $tabactive = 'cardmonth'; |
|
| 377 | -if ($action == 'show_week') |
|
| 378 | - $tabactive = 'cardweek'; |
|
| 379 | -if ($action == 'show_day') |
|
| 380 | - $tabactive = 'cardday'; |
|
| 381 | -if ($action == 'show_list') |
|
| 382 | - $tabactive = 'cardlist'; |
|
| 405 | +if ($action == 'show_month') { |
|
| 406 | + $tabactive = 'cardmonth'; |
|
| 407 | +} |
|
| 408 | +if ($action == 'show_week') { |
|
| 409 | + $tabactive = 'cardweek'; |
|
| 410 | +} |
|
| 411 | +if ($action == 'show_day') { |
|
| 412 | + $tabactive = 'cardday'; |
|
| 413 | +} |
|
| 414 | +if ($action == 'show_list') { |
|
| 415 | + $tabactive = 'cardlist'; |
|
| 416 | +} |
|
| 383 | 417 | |
| 384 | 418 | $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param);
|
| 385 | 419 | |
| 386 | 420 | $head = calendars_prepare_head($paramnoaction); |
| 387 | 421 | |
| 388 | 422 | print '<form method="POST" id="searchFormList" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '">' . "\n"; |
| 389 | -if ($optioncss != '') |
|
| 390 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 423 | +if ($optioncss != '') { |
|
| 424 | + print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 425 | +} |
|
| 391 | 426 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
| 392 | 427 | |
| 393 | 428 | dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
@@ -459,15 +494,17 @@ discard block |
||
| 459 | 494 | } else { // If javascript off
|
| 460 | 495 | $newparam = $param; // newparam is for birthday links |
| 461 | 496 | $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday=' . (empty($showbirthday) ? 1 : 0), $newparam);
|
| 462 | - if (!preg_match('/showbirthday=/i', $newparam))
|
|
| 463 | - $newparam .= '&showbirthday=1'; |
|
| 497 | + if (!preg_match('/showbirthday=/i', $newparam)) { |
|
| 498 | + $newparam .= '&showbirthday=1'; |
|
| 499 | + } |
|
| 464 | 500 | $link = '<a href="' . dol_escape_htmltag($_SERVER['PHP_SELF']); |
| 465 | 501 | $link .= '?' . dol_escape_htmltag($newparam); |
| 466 | 502 | $link .= '">'; |
| 467 | - if (empty($showbirthday)) |
|
| 468 | - $link .= $langs->trans("AgendaShowBirthdayEvents");
|
|
| 469 | - else |
|
| 470 | - $link .= $langs->trans("AgendaHideBirthdayEvents");
|
|
| 503 | + if (empty($showbirthday)) { |
|
| 504 | + $link .= $langs->trans("AgendaShowBirthdayEvents"); |
|
| 505 | + } else { |
|
| 506 | + $link .= $langs->trans("AgendaHideBirthdayEvents"); |
|
| 507 | + } |
|
| 471 | 508 | $link .= '</a>'; |
| 472 | 509 | } |
| 473 | 510 | |
@@ -478,8 +515,9 @@ discard block |
||
| 478 | 515 | $eventarray = array(); |
| 479 | 516 | |
| 480 | 517 | $sql = 'SELECT '; |
| 481 | -if ($usergroup > 0) |
|
| 482 | - $sql .= " DISTINCT"; |
|
| 518 | +if ($usergroup > 0) { |
|
| 519 | + $sql .= " DISTINCT"; |
|
| 520 | +} |
|
| 483 | 521 | $sql .= ' a.id, a.label,'; |
| 484 | 522 | $sql .= ' a.datep,'; |
| 485 | 523 | $sql .= ' a.datep2,'; |
@@ -490,38 +528,43 @@ discard block |
||
| 490 | 528 | $sql .= ' a.fk_element, a.elementtype,'; |
| 491 | 529 | $sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color'; |
| 492 | 530 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_actioncomm as ca, ' . MAIN_DB_PREFIX . "actioncomm as a"; |
| 493 | -if (!$user->rights->societe->client->voir && !$socid) |
|
| 494 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 531 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 532 | + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 533 | +} |
|
| 495 | 534 | // We must filter on resource table |
| 496 | -if ($resourceid > 0) |
|
| 497 | - $sql .= ", " . MAIN_DB_PREFIX . "element_resources as r"; |
|
| 535 | +if ($resourceid > 0) { |
|
| 536 | + $sql .= ", " . MAIN_DB_PREFIX . "element_resources as r"; |
|
| 537 | +} |
|
| 498 | 538 | // We must filter on assignement table |
| 499 | -if ($filtert > 0 || $usergroup > 0) |
|
| 500 | - $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 501 | -if ($usergroup > 0) |
|
| 502 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 539 | +if ($filtert > 0 || $usergroup > 0) { |
|
| 540 | + $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 541 | +} |
|
| 542 | +if ($usergroup > 0) { |
|
| 543 | + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; |
|
| 544 | +} |
|
| 503 | 545 | $sql .= ' WHERE a.fk_action = ca.id'; |
| 504 | 546 | $sql .= ' AND a.entity IN (' . getEntity('agenda') . ')';
|
| 505 | 547 | // Condition on actioncode |
| 506 | 548 | if (!empty($actioncode)) {
|
| 507 | 549 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
| 508 | - if ($actioncode == 'AC_NON_AUTO') |
|
| 509 | - $sql .= " AND ca.type != 'systemauto'"; |
|
| 510 | - elseif ($actioncode == 'AC_ALL_AUTO') |
|
| 511 | - $sql .= " AND ca.type = 'systemauto'"; |
|
| 512 | - else {
|
|
| 513 | - if ($actioncode == 'AC_OTH') |
|
| 514 | - $sql .= " AND ca.type != 'systemauto'"; |
|
| 515 | - if ($actioncode == 'AC_OTH_AUTO') |
|
| 516 | - $sql .= " AND ca.type = 'systemauto'"; |
|
| 550 | + if ($actioncode == 'AC_NON_AUTO') { |
|
| 551 | + $sql .= " AND ca.type != 'systemauto'"; |
|
| 552 | + } elseif ($actioncode == 'AC_ALL_AUTO') { |
|
| 553 | + $sql .= " AND ca.type = 'systemauto'"; |
|
| 554 | + } else {
|
|
| 555 | + if ($actioncode == 'AC_OTH') { |
|
| 556 | + $sql .= " AND ca.type != 'systemauto'"; |
|
| 557 | + } |
|
| 558 | + if ($actioncode == 'AC_OTH_AUTO') { |
|
| 559 | + $sql .= " AND ca.type = 'systemauto'"; |
|
| 560 | + } |
|
| 517 | 561 | } |
| 518 | - } |
|
| 519 | - else {
|
|
| 520 | - if ($actioncode == 'AC_NON_AUTO') |
|
| 521 | - $sql .= " AND ca.type != 'systemauto'"; |
|
| 522 | - elseif ($actioncode == 'AC_ALL_AUTO') |
|
| 523 | - $sql .= " AND ca.type = 'systemauto'"; |
|
| 524 | - else {
|
|
| 562 | + } else {
|
|
| 563 | + if ($actioncode == 'AC_NON_AUTO') { |
|
| 564 | + $sql .= " AND ca.type != 'systemauto'"; |
|
| 565 | + } elseif ($actioncode == 'AC_ALL_AUTO') { |
|
| 566 | + $sql .= " AND ca.type = 'systemauto'"; |
|
| 567 | + } else {
|
|
| 525 | 568 | if (is_array($actioncode)) {
|
| 526 | 569 | $sql .= " AND ca.code IN ('" . implode("','", $actioncode) . "')";
|
| 527 | 570 | } else {
|
@@ -530,17 +573,22 @@ discard block |
||
| 530 | 573 | } |
| 531 | 574 | } |
| 532 | 575 | } |
| 533 | -if ($resourceid > 0) |
|
| 534 | - $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = " . $db->escape($resourceid); |
|
| 535 | -if ($pid) |
|
| 536 | - $sql .= " AND a.fk_project=" . $db->escape($pid); |
|
| 537 | -if (!$user->rights->societe->client->voir && !$socid) |
|
| 538 | - $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 539 | -if ($socid > 0) |
|
| 540 | - $sql .= ' AND a.fk_soc = ' . $socid; |
|
| 576 | +if ($resourceid > 0) { |
|
| 577 | + $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = " . $db->escape($resourceid); |
|
| 578 | +} |
|
| 579 | +if ($pid) { |
|
| 580 | + $sql .= " AND a.fk_project=" . $db->escape($pid); |
|
| 581 | +} |
|
| 582 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
| 583 | + $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 584 | +} |
|
| 585 | +if ($socid > 0) { |
|
| 586 | + $sql .= ' AND a.fk_soc = ' . $socid; |
|
| 587 | +} |
|
| 541 | 588 | // We must filter on assignement table |
| 542 | -if ($filtert > 0 || $usergroup > 0) |
|
| 543 | - $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
|
| 589 | +if ($filtert > 0 || $usergroup > 0) { |
|
| 590 | + $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
|
| 591 | +} |
|
| 544 | 592 | if ($action == 'show_day') {
|
| 545 | 593 | $sql .= " AND (";
|
| 546 | 594 | $sql .= " (a.datep BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "'"; |
@@ -565,8 +613,9 @@ discard block |
||
| 565 | 613 | $sql .= " AND a.datep2 > '" . $db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10)) . "')"; |
| 566 | 614 | $sql .= ')'; |
| 567 | 615 | } |
| 568 | -if ($type) |
|
| 569 | - $sql .= " AND ca.id = " . $type; |
|
| 616 | +if ($type) { |
|
| 617 | + $sql .= " AND ca.id = " . $type; |
|
| 618 | +} |
|
| 570 | 619 | if ($status == '0') {
|
| 571 | 620 | $sql .= " AND a.percent = 0"; |
| 572 | 621 | } |
@@ -585,10 +634,12 @@ discard block |
||
| 585 | 634 | // We must filter on assignement table |
| 586 | 635 | if ($filtert > 0 || $usergroup > 0) {
|
| 587 | 636 | $sql .= " AND (";
|
| 588 | - if ($filtert > 0) |
|
| 589 | - $sql .= "ar.fk_element = " . $filtert; |
|
| 590 | - if ($usergroup > 0) |
|
| 591 | - $sql .= ($filtert > 0 ? " OR " : "") . " ugu.fk_usergroup = " . $usergroup; |
|
| 637 | + if ($filtert > 0) { |
|
| 638 | + $sql .= "ar.fk_element = " . $filtert; |
|
| 639 | + } |
|
| 640 | + if ($usergroup > 0) { |
|
| 641 | + $sql .= ($filtert > 0 ? " OR " : "") . " ugu.fk_usergroup = " . $usergroup; |
|
| 642 | + } |
|
| 592 | 643 | $sql .= ")"; |
| 593 | 644 | } |
| 594 | 645 | // Sort on date |
@@ -647,17 +698,18 @@ discard block |
||
| 647 | 698 | // They are date start and end of action but modified to not be outside calendar view. |
| 648 | 699 | if ($event->percentage <= 0) {
|
| 649 | 700 | $event->date_start_in_calendar = $event->datep; |
| 650 | - if ($event->datef != '' && $event->datef >= $event->datep) |
|
| 651 | - $event->date_end_in_calendar = $event->datef; |
|
| 652 | - else |
|
| 653 | - $event->date_end_in_calendar = $event->datep; |
|
| 654 | - } |
|
| 655 | - else {
|
|
| 701 | + if ($event->datef != '' && $event->datef >= $event->datep) { |
|
| 702 | + $event->date_end_in_calendar = $event->datef; |
|
| 703 | + } else { |
|
| 704 | + $event->date_end_in_calendar = $event->datep; |
|
| 705 | + } |
|
| 706 | + } else {
|
|
| 656 | 707 | $event->date_start_in_calendar = $event->datep; |
| 657 | - if ($event->datef != '' && $event->datef >= $event->datep) |
|
| 658 | - $event->date_end_in_calendar = $event->datef; |
|
| 659 | - else |
|
| 660 | - $event->date_end_in_calendar = $event->datep; |
|
| 708 | + if ($event->datef != '' && $event->datef >= $event->datep) { |
|
| 709 | + $event->date_end_in_calendar = $event->datef; |
|
| 710 | + } else { |
|
| 711 | + $event->date_end_in_calendar = $event->datep; |
|
| 712 | + } |
|
| 661 | 713 | } |
| 662 | 714 | // Define ponctual property |
| 663 | 715 | if ($event->date_start_in_calendar == $event->date_end_in_calendar) {
|
@@ -669,10 +721,12 @@ discard block |
||
| 669 | 721 | $event->date_start_in_calendar >= $lastdaytoshow) {
|
| 670 | 722 | // This record is out of visible range |
| 671 | 723 | } else {
|
| 672 | - if ($event->date_start_in_calendar < $firstdaytoshow) |
|
| 673 | - $event->date_start_in_calendar = $firstdaytoshow; |
|
| 674 | - if ($event->date_end_in_calendar >= $lastdaytoshow) |
|
| 675 | - $event->date_end_in_calendar = ($lastdaytoshow - 1); |
|
| 724 | + if ($event->date_start_in_calendar < $firstdaytoshow) { |
|
| 725 | + $event->date_start_in_calendar = $firstdaytoshow; |
|
| 726 | + } |
|
| 727 | + if ($event->date_end_in_calendar >= $lastdaytoshow) { |
|
| 728 | + $event->date_end_in_calendar = ($lastdaytoshow - 1); |
|
| 729 | + } |
|
| 676 | 730 | |
| 677 | 731 | // Add an entry in actionarray for each day |
| 678 | 732 | $daycursor = $event->date_start_in_calendar; |
@@ -691,8 +745,9 @@ discard block |
||
| 691 | 745 | $j++; |
| 692 | 746 | |
| 693 | 747 | $daykey += 60 * 60 * 24; |
| 694 | - if ($daykey > $event->date_end_in_calendar) |
|
| 695 | - $loop = false; |
|
| 748 | + if ($daykey > $event->date_end_in_calendar) { |
|
| 749 | + $loop = false; |
|
| 750 | + } |
|
| 696 | 751 | } |
| 697 | 752 | while ($loop); |
| 698 | 753 | |
@@ -701,8 +756,7 @@ discard block |
||
| 701 | 756 | } |
| 702 | 757 | $i++; |
| 703 | 758 | } |
| 704 | -} |
|
| 705 | -else {
|
|
| 759 | +} else {
|
|
| 706 | 760 | dol_print_error($db); |
| 707 | 761 | } |
| 708 | 762 | |
@@ -755,14 +809,14 @@ discard block |
||
| 755 | 809 | do {
|
| 756 | 810 | $eventarray[$daykey][] = $event; |
| 757 | 811 | $daykey += 60 * 60 * 24; |
| 758 | - if ($daykey > $event->date_end_in_calendar) |
|
| 759 | - $loop = false; |
|
| 812 | + if ($daykey > $event->date_end_in_calendar) { |
|
| 813 | + $loop = false; |
|
| 814 | + } |
|
| 760 | 815 | } |
| 761 | 816 | while ($loop); |
| 762 | 817 | $i++; |
| 763 | 818 | } |
| 764 | - } |
|
| 765 | - else {
|
|
| 819 | + } else {
|
|
| 766 | 820 | dol_print_error($db); |
| 767 | 821 | } |
| 768 | 822 | } |
@@ -783,10 +837,14 @@ discard block |
||
| 783 | 837 | // After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ... |
| 784 | 838 | //var_dump($ical->cal); exit; |
| 785 | 839 | $icalevents = array(); |
| 786 | - if (is_array($ical->get_event_list())) |
|
| 787 | - $icalevents = array_merge($icalevents, $ical->get_event_list()); // Add $ical->cal['VEVENT'] |
|
| 788 | - if (is_array($ical->get_freebusy_list())) |
|
| 789 | - $icalevents = array_merge($icalevents, $ical->get_freebusy_list()); // Add $ical->cal['VFREEBUSY'] |
|
| 840 | + if (is_array($ical->get_event_list())) { |
|
| 841 | + $icalevents = array_merge($icalevents, $ical->get_event_list()); |
|
| 842 | + } |
|
| 843 | + // Add $ical->cal['VEVENT'] |
|
| 844 | + if (is_array($ical->get_freebusy_list())) { |
|
| 845 | + $icalevents = array_merge($icalevents, $ical->get_freebusy_list()); |
|
| 846 | + } |
|
| 847 | + // Add $ical->cal['VFREEBUSY'] |
|
| 790 | 848 | |
| 791 | 849 | if (count($icalevents) > 0) {
|
| 792 | 850 | // Duplicate all repeatable events into new entries |
@@ -809,19 +867,20 @@ discard block |
||
| 809 | 867 | $tmpdaylightend = dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal['STANDARD']['DTSTART']; |
| 810 | 868 | //var_dump($tmpcurstart);var_dump($tmpcurend); var_dump($ical->cal['DAYLIGHT']['DTSTART']);var_dump($ical->cal['STANDARD']['DTSTART']); |
| 811 | 869 | // Edit datecurstart and datecurend |
| 812 | - if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) |
|
| 813 | - $datecurstart -= ((int) $ical->cal['DAYLIGHT']['TZOFFSETTO']) * 36; |
|
| 814 | - else |
|
| 815 | - $datecurstart -= ((int) $ical->cal['STANDARD']['TZOFFSETTO']) * 36; |
|
| 816 | - if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) |
|
| 817 | - $datecurend -= ((int) $ical->cal['DAYLIGHT']['TZOFFSETTO']) * 36; |
|
| 818 | - else |
|
| 819 | - $datecurend -= ((int) $ical->cal['STANDARD']['TZOFFSETTO']) * 36; |
|
| 870 | + if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) { |
|
| 871 | + $datecurstart -= ((int) $ical->cal['DAYLIGHT']['TZOFFSETTO']) * 36; |
|
| 872 | + } else { |
|
| 873 | + $datecurstart -= ((int) $ical->cal['STANDARD']['TZOFFSETTO']) * 36; |
|
| 874 | + } |
|
| 875 | + if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) { |
|
| 876 | + $datecurend -= ((int) $ical->cal['DAYLIGHT']['TZOFFSETTO']) * 36; |
|
| 877 | + } else { |
|
| 878 | + $datecurend -= ((int) $ical->cal['STANDARD']['TZOFFSETTO']) * 36; |
|
| 879 | + } |
|
| 820 | 880 | } |
| 821 | 881 | // datecurstart and datecurend are now GMT date |
| 822 | 882 | //var_dump($datecurstart); var_dump($datecurend); exit; |
| 823 | - } |
|
| 824 | - else {
|
|
| 883 | + } else {
|
|
| 825 | 884 | // Not a recongized record |
| 826 | 885 | dol_syslog("Found a not recognized repeatable record with unknown date start", LOG_ERR);
|
| 827 | 886 | continue; |
@@ -831,10 +890,14 @@ discard block |
||
| 831 | 890 | $interval = (empty($icalevent['RRULE']['INTERVAL']) ? 1 : $icalevent['RRULE']['INTERVAL']); |
| 832 | 891 | $until = empty($icalevent['RRULE']['UNTIL']) ? 0 : dol_stringtotime($icalevent['RRULE']['UNTIL'], 1); |
| 833 | 892 | $maxrepeat = empty($icalevent['RRULE']['COUNT']) ? 0 : $icalevent['RRULE']['COUNT']; |
| 834 | - if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) |
|
| 835 | - continue; // We discard repeatable event that end before start date to show |
|
| 836 | - if ($datecurstart >= $lastdaytoshow) |
|
| 837 | - continue; // We discard repeatable event that start after end date to show |
|
| 893 | + if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) { |
|
| 894 | + continue; |
|
| 895 | + } |
|
| 896 | + // We discard repeatable event that end before start date to show |
|
| 897 | + if ($datecurstart >= $lastdaytoshow) { |
|
| 898 | + continue; |
|
| 899 | + } |
|
| 900 | + // We discard repeatable event that start after end date to show |
|
| 838 | 901 | |
| 839 | 902 | $numofevent = 0; |
| 840 | 903 | while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
|
@@ -882,8 +945,10 @@ discard block |
||
| 882 | 945 | foreach ($icalevents as $icalevent) {
|
| 883 | 946 | //var_dump($icalevent); |
| 884 | 947 | //print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit; |
| 885 | - if (!empty($icalevent['RRULE'])) |
|
| 886 | - continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule. |
|
| 948 | + if (!empty($icalevent['RRULE'])) { |
|
| 949 | + continue; |
|
| 950 | + } |
|
| 951 | + // We found a repeatable event. It was already split into unitary events, so we discard general rule. |
|
| 887 | 952 | |
| 888 | 953 | |
| 889 | 954 | |
@@ -943,19 +1008,21 @@ discard block |
||
| 943 | 1008 | $event->datef = $dateend + $usertime; |
| 944 | 1009 | $event->type_code = "ICALEVENT"; |
| 945 | 1010 | |
| 946 | - if ($icalevent['SUMMARY']) |
|
| 947 | - $event->libelle = $icalevent['SUMMARY']; |
|
| 948 | - elseif ($icalevent['DESCRIPTION']) |
|
| 949 | - $event->libelle = dol_nl2br($icalevent['DESCRIPTION'], 1); |
|
| 950 | - else |
|
| 951 | - $event->libelle = $langs->trans("ExtSiteNoLabel");
|
|
| 1011 | + if ($icalevent['SUMMARY']) { |
|
| 1012 | + $event->libelle = $icalevent['SUMMARY']; |
|
| 1013 | + } elseif ($icalevent['DESCRIPTION']) { |
|
| 1014 | + $event->libelle = dol_nl2br($icalevent['DESCRIPTION'], 1); |
|
| 1015 | + } else { |
|
| 1016 | + $event->libelle = $langs->trans("ExtSiteNoLabel"); |
|
| 1017 | + } |
|
| 952 | 1018 | |
| 953 | 1019 | $event->date_start_in_calendar = $event->datep; |
| 954 | 1020 | |
| 955 | - if ($event->datef != '' && $event->datef >= $event->datep) |
|
| 956 | - $event->date_end_in_calendar = $event->datef; |
|
| 957 | - else |
|
| 958 | - $event->date_end_in_calendar = $event->datep; |
|
| 1021 | + if ($event->datef != '' && $event->datef >= $event->datep) { |
|
| 1022 | + $event->date_end_in_calendar = $event->datef; |
|
| 1023 | + } else { |
|
| 1024 | + $event->date_end_in_calendar = $event->datep; |
|
| 1025 | + } |
|
| 959 | 1026 | |
| 960 | 1027 | // Define ponctual property |
| 961 | 1028 | if ($event->date_start_in_calendar == $event->date_end_in_calendar) {
|
@@ -970,10 +1037,12 @@ discard block |
||
| 970 | 1037 | //print 'x'.$datestart.'-'.$dateend;exit; |
| 971 | 1038 | // This record is out of visible range |
| 972 | 1039 | } else {
|
| 973 | - if ($event->date_start_in_calendar < $firstdaytoshow) |
|
| 974 | - $event->date_start_in_calendar = $firstdaytoshow; |
|
| 975 | - if ($event->date_end_in_calendar >= $lastdaytoshow) |
|
| 976 | - $event->date_end_in_calendar = ($lastdaytoshow - 1); |
|
| 1040 | + if ($event->date_start_in_calendar < $firstdaytoshow) { |
|
| 1041 | + $event->date_start_in_calendar = $firstdaytoshow; |
|
| 1042 | + } |
|
| 1043 | + if ($event->date_end_in_calendar >= $lastdaytoshow) { |
|
| 1044 | + $event->date_end_in_calendar = ($lastdaytoshow - 1); |
|
| 1045 | + } |
|
| 977 | 1046 | |
| 978 | 1047 | // Add an entry in actionarray for each day |
| 979 | 1048 | $daycursor = $event->date_start_in_calendar; |
@@ -992,8 +1061,9 @@ discard block |
||
| 992 | 1061 | $eventarray[$daykey][] = $event; |
| 993 | 1062 | $daykey += 60 * 60 * 24; |
| 994 | 1063 | $daykeygmt += 60 * 60 * 24; // Add one day |
| 995 | - if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) |
|
| 996 | - $loop = false; |
|
| 1064 | + if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) { |
|
| 1065 | + $loop = false; |
|
| 1066 | + } |
|
| 997 | 1067 | } |
| 998 | 1068 | while ($loop); |
| 999 | 1069 | } |
@@ -1030,8 +1100,9 @@ discard block |
||
| 1030 | 1100 | if (is_readable($color_file)) {
|
| 1031 | 1101 | include_once $color_file; |
| 1032 | 1102 | } |
| 1033 | -if (!is_array($theme_datacolor)) |
|
| 1034 | - $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220)); |
|
| 1103 | +if (!is_array($theme_datacolor)) { |
|
| 1104 | + $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220)); |
|
| 1105 | +} |
|
| 1035 | 1106 | |
| 1036 | 1107 | |
| 1037 | 1108 | if (empty($action) || $action == 'show_month') { // View by month
|
@@ -1057,8 +1128,9 @@ discard block |
||
| 1057 | 1128 | if (!empty($conf->dol_optimize_smallscreen)) {
|
| 1058 | 1129 | $labelshort = array(0 => 'SundayMin', 1 => 'MondayMin', 2 => 'TuesdayMin', 3 => 'WednesdayMin', 4 => 'ThursdayMin', 5 => 'FridayMin', 6 => 'SaturdayMin'); |
| 1059 | 1130 | print $langs->trans($labelshort[$numdayinweek]); |
| 1060 | - } else |
|
| 1061 | - print $langs->trans("Day" . $numdayinweek);
|
|
| 1131 | + } else { |
|
| 1132 | + print $langs->trans("Day" . $numdayinweek); |
|
| 1133 | + } |
|
| 1062 | 1134 | print ' </td>' . "\n"; |
| 1063 | 1135 | $i++; |
| 1064 | 1136 | } |
@@ -1075,8 +1147,9 @@ discard block |
||
| 1075 | 1147 | /* Show days before the beginning of the current month (previous month) */ |
| 1076 | 1148 | if ($tmpday <= 0) {
|
| 1077 | 1149 | $style = 'cal_other_month cal_past'; |
| 1078 | - if ($iter_day == 6) |
|
| 1079 | - $style .= ' cal_other_month_right'; |
|
| 1150 | + if ($iter_day == 6) { |
|
| 1151 | + $style .= ' cal_other_month_right'; |
|
| 1152 | + } |
|
| 1080 | 1153 | echo ' <td class="' . $style . ' nowrap" width="14%" valign="top">'; |
| 1081 | 1154 | show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); |
| 1082 | 1155 | echo " </td>\n"; |
@@ -1085,15 +1158,19 @@ discard block |
||
| 1085 | 1158 | elseif ($tmpday <= $max_day_in_month) {
|
| 1086 | 1159 | $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); |
| 1087 | 1160 | $style = 'cal_current_month'; |
| 1088 | - if ($iter_day == 6) |
|
| 1089 | - $style .= ' cal_current_month_right'; |
|
| 1161 | + if ($iter_day == 6) { |
|
| 1162 | + $style .= ' cal_current_month_right'; |
|
| 1163 | + } |
|
| 1090 | 1164 | $today = 0; |
| 1091 | - if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) |
|
| 1092 | - $today = 1; |
|
| 1093 | - if ($today) |
|
| 1094 | - $style = 'cal_today'; |
|
| 1095 | - if ($curtime < $todaytms) |
|
| 1096 | - $style .= ' cal_past'; |
|
| 1165 | + if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) { |
|
| 1166 | + $today = 1; |
|
| 1167 | + } |
|
| 1168 | + if ($today) { |
|
| 1169 | + $style = 'cal_today'; |
|
| 1170 | + } |
|
| 1171 | + if ($curtime < $todaytms) { |
|
| 1172 | + $style .= ' cal_past'; |
|
| 1173 | + } |
|
| 1097 | 1174 | //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style); |
| 1098 | 1175 | echo ' <td class="' . $style . ' nowrap" width="14%" valign="top">'; |
| 1099 | 1176 | show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); |
@@ -1102,8 +1179,9 @@ discard block |
||
| 1102 | 1179 | /* Show days after the current month (next month) */ |
| 1103 | 1180 | else {
|
| 1104 | 1181 | $style = 'cal_other_month'; |
| 1105 | - if ($iter_day == 6) |
|
| 1106 | - $style .= ' cal_other_month_right'; |
|
| 1182 | + if ($iter_day == 6) { |
|
| 1183 | + $style .= ' cal_other_month_right'; |
|
| 1184 | + } |
|
| 1107 | 1185 | echo ' <td class="' . $style . ' nowrap" width="14%" valign="top">'; |
| 1108 | 1186 | show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); |
| 1109 | 1187 | echo "</td>\n"; |
@@ -1118,8 +1196,7 @@ discard block |
||
| 1118 | 1196 | print '<input type="hidden" name="actionmove" value="mupdate">'; |
| 1119 | 1197 | print '<input type="hidden" name="backtopage" value="' . dol_escape_htmltag($_SERVER['PHP_SELF']) . '?' . dol_escape_htmltag($_SERVER['QUERY_STRING']) . '">'; |
| 1120 | 1198 | print '<input type="hidden" name="newdate" id="newdate">'; |
| 1121 | -} |
|
| 1122 | -elseif ($action == 'show_week') { // View by week
|
|
| 1199 | +} elseif ($action == 'show_week') { // View by week
|
|
| 1123 | 1200 | $newparam = $param; // newparam is for birthday links |
| 1124 | 1201 | $newparam = preg_replace('/showbirthday=/i', 'showbirthday_=', $newparam); // To avoid replacement when replace day= is done
|
| 1125 | 1202 | $newparam = preg_replace('/action=show_month&?/i', '', $newparam);
|
@@ -1152,14 +1229,17 @@ discard block |
||
| 1152 | 1229 | $tmpyear = $tmparray['year']; |
| 1153 | 1230 | |
| 1154 | 1231 | $style = 'cal_current_month'; |
| 1155 | - if ($iter_day == 6) |
|
| 1156 | - $style .= ' cal_other_month_right'; |
|
| 1232 | + if ($iter_day == 6) { |
|
| 1233 | + $style .= ' cal_other_month_right'; |
|
| 1234 | + } |
|
| 1157 | 1235 | $today = 0; |
| 1158 | 1236 | $todayarray = dol_getdate($now, 'fast'); |
| 1159 | - if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) |
|
| 1160 | - $today = 1; |
|
| 1161 | - if ($today) |
|
| 1162 | - $style = 'cal_today'; |
|
| 1237 | + if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) { |
|
| 1238 | + $today = 1; |
|
| 1239 | + } |
|
| 1240 | + if ($today) { |
|
| 1241 | + $style = 'cal_today'; |
|
| 1242 | + } |
|
| 1163 | 1243 | |
| 1164 | 1244 | echo ' <td class="' . $style . '" width="14%" valign="top">'; |
| 1165 | 1245 | show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); |
@@ -1173,8 +1253,7 @@ discard block |
||
| 1173 | 1253 | echo '<input type="hidden" name="actionmove" value="mupdate">'; |
| 1174 | 1254 | echo '<input type="hidden" name="backtopage" value="' . dol_escape_htmltag($_SERVER['PHP_SELF']) . '?' . dol_escape_htmltag($_SERVER['QUERY_STRING']) . '">'; |
| 1175 | 1255 | echo '<input type="hidden" name="newdate" id="newdate">'; |
| 1176 | -} |
|
| 1177 | -else { // View by day
|
|
| 1256 | +} else { // View by day
|
|
| 1178 | 1257 | $newparam = $param; // newparam is for birthday links |
| 1179 | 1258 | $newparam = preg_replace('/action=show_month&?/i', '', $newparam);
|
| 1180 | 1259 | $newparam = preg_replace('/action=show_week&?/i', '', $newparam);
|
@@ -1184,8 +1263,9 @@ discard block |
||
| 1184 | 1263 | $style = 'cal_current_month cal_current_month_oneday'; |
| 1185 | 1264 | $today = 0; |
| 1186 | 1265 | $todayarray = dol_getdate($now, 'fast'); |
| 1187 | - if ($todayarray['mday'] == $day && $todayarray['mon'] == $month && $todayarray['year'] == $year) |
|
| 1188 | - $today = 1; |
|
| 1266 | + if ($todayarray['mday'] == $day && $todayarray['mon'] == $month && $todayarray['year'] == $year) { |
|
| 1267 | + $today = 1; |
|
| 1268 | + } |
|
| 1189 | 1269 | //if ($today) $style='cal_today'; |
| 1190 | 1270 | |
| 1191 | 1271 | $timestamp = dol_mktime(12, 0, 0, $month, $day, $year); |
@@ -1225,10 +1305,12 @@ discard block |
||
| 1225 | 1305 | $tmp = explode('-', $conf->global->MAIN_DEFAULT_WORKING_HOURS);
|
| 1226 | 1306 | $minhour = round($tmp[0], 0); |
| 1227 | 1307 | $maxhour = round($tmp[1], 0); |
| 1228 | - if ($minhour > 23) |
|
| 1229 | - $minhour = 23; |
|
| 1230 | - if ($maxhour < 1) |
|
| 1231 | - $maxhour = 1; |
|
| 1308 | + if ($minhour > 23) { |
|
| 1309 | + $minhour = 23; |
|
| 1310 | + } |
|
| 1311 | + if ($maxhour < 1) { |
|
| 1312 | + $maxhour = 1; |
|
| 1313 | + } |
|
| 1232 | 1314 | if ($maxhour <= $minhour) {
|
| 1233 | 1315 | $maxhour = $minhour + 1; |
| 1234 | 1316 | } |
@@ -1304,10 +1386,11 @@ discard block |
||
| 1304 | 1386 | print 'action=show_day&day=' . str_pad($day, 2, "0", STR_PAD_LEFT) . '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year; |
| 1305 | 1387 | print $newparam; |
| 1306 | 1388 | print '">'; |
| 1307 | - if ($showinfo) |
|
| 1308 | - print dol_print_date($curtime, 'daytextshort'); |
|
| 1309 | - else |
|
| 1310 | - print dol_print_date($curtime, '%d'); |
|
| 1389 | + if ($showinfo) { |
|
| 1390 | + print dol_print_date($curtime, 'daytextshort'); |
|
| 1391 | + } else { |
|
| 1392 | + print dol_print_date($curtime, '%d'); |
|
| 1393 | + } |
|
| 1311 | 1394 | print '</a>'; |
| 1312 | 1395 | print '</div><div class="floatright nowrap">'; |
| 1313 | 1396 | if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
|
@@ -1367,10 +1450,10 @@ discard block |
||
| 1367 | 1450 | } |
| 1368 | 1451 | //var_dump($cacheusers[$event->userownerid]->color); |
| 1369 | 1452 | // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) |
| 1370 | - if (!empty($cacheusers[$event->userownerid]->color)) |
|
| 1371 | - $color = $cacheusers[$event->userownerid]->color; |
|
| 1372 | - } |
|
| 1373 | - else if ($event->type_code == 'ICALEVENT') { // Event come from external ical file
|
|
| 1453 | + if (!empty($cacheusers[$event->userownerid]->color)) { |
|
| 1454 | + $color = $cacheusers[$event->userownerid]->color; |
|
| 1455 | + } |
|
| 1456 | + } else if ($event->type_code == 'ICALEVENT') { // Event come from external ical file
|
|
| 1374 | 1457 | $numical++; |
| 1375 | 1458 | if (!empty($event->icalname)) {
|
| 1376 | 1459 | if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
|
@@ -1398,8 +1481,9 @@ discard block |
||
| 1398 | 1481 | } |
| 1399 | 1482 | //var_dump($cacheusers[$event->userownerid]->color); |
| 1400 | 1483 | // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) |
| 1401 | - if (!empty($cacheusers[$event->userownerid]->color)) |
|
| 1402 | - $color = $cacheusers[$event->userownerid]->color; |
|
| 1484 | + if (!empty($cacheusers[$event->userownerid]->color)) { |
|
| 1485 | + $color = $cacheusers[$event->userownerid]->color; |
|
| 1486 | + } |
|
| 1403 | 1487 | } |
| 1404 | 1488 | |
| 1405 | 1489 | if ($color < 0) { // Color was not set on user card. Set color according to color index.
|
@@ -1410,8 +1494,10 @@ discard block |
||
| 1410 | 1494 | } else {
|
| 1411 | 1495 | $colorindex = $nextindextouse; |
| 1412 | 1496 | $colorindexused[$idusertouse] = $colorindex; |
| 1413 | - if (!empty($theme_datacolor[$nextindextouse + 1])) |
|
| 1414 | - $nextindextouse++; // Prepare to use next color |
|
| 1497 | + if (!empty($theme_datacolor[$nextindextouse + 1])) { |
|
| 1498 | + $nextindextouse++; |
|
| 1499 | + } |
|
| 1500 | + // Prepare to use next color |
|
| 1415 | 1501 | } |
| 1416 | 1502 | //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>'; |
| 1417 | 1503 | // Define color |
@@ -1501,8 +1587,9 @@ discard block |
||
| 1501 | 1587 | if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) {
|
| 1502 | 1588 | $daterange .= dol_print_date($event->date_start_in_calendar, '%H:%M'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user |
| 1503 | 1589 | if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
|
| 1504 | - if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) |
|
| 1505 | - $daterange .= '-'; |
|
| 1590 | + if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) { |
|
| 1591 | + $daterange .= '-'; |
|
| 1592 | + } |
|
| 1506 | 1593 | //else |
| 1507 | 1594 | //print '...'; |
| 1508 | 1595 | } |
@@ -1514,11 +1601,12 @@ discard block |
||
| 1514 | 1601 | } |
| 1515 | 1602 | // Hour end |
| 1516 | 1603 | if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
|
| 1517 | - if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) |
|
| 1518 | - $daterange .= dol_print_date($event->date_end_in_calendar, '%H:%M'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user |
|
| 1604 | + if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) { |
|
| 1605 | + $daterange .= dol_print_date($event->date_end_in_calendar, '%H:%M'); |
|
| 1606 | + } |
|
| 1607 | + // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user |
|
| 1519 | 1608 | } |
| 1520 | - } |
|
| 1521 | - else {
|
|
| 1609 | + } else {
|
|
| 1522 | 1610 | if ($showinfo) {
|
| 1523 | 1611 | print $langs->trans("EventOnFullDay") . "<br>\n";
|
| 1524 | 1612 | } |
@@ -1528,9 +1616,9 @@ discard block |
||
| 1528 | 1616 | $titletoshow = $daterange; |
| 1529 | 1617 | $titletoshow .= ($titletoshow ? ' ' : '') . $event->libelle; |
| 1530 | 1618 | |
| 1531 | - if ($event->type_code == 'ICALEVENT') |
|
| 1532 | - print $titletoshow; |
|
| 1533 | - else {
|
|
| 1619 | + if ($event->type_code == 'ICALEVENT') { |
|
| 1620 | + print $titletoshow; |
|
| 1621 | + } else {
|
|
| 1534 | 1622 | $savlabel = $event->label ? $event->label : $event->libelle; |
| 1535 | 1623 | $event->label = $titletoshow; |
| 1536 | 1624 | $event->libelle = $titletoshow; |
@@ -1543,8 +1631,9 @@ discard block |
||
| 1543 | 1631 | $listofusertoshow = ''; |
| 1544 | 1632 | $posuserassigned = 0; |
| 1545 | 1633 | foreach ($event->userassigned as $tmpid => $tmpdata) {
|
| 1546 | - if (!$posuserassigned && $titletoshow) |
|
| 1547 | - $listofusertoshow .= '<br>'; |
|
| 1634 | + if (!$posuserassigned && $titletoshow) { |
|
| 1635 | + $listofusertoshow .= '<br>'; |
|
| 1636 | + } |
|
| 1548 | 1637 | $posuserassigned++; |
| 1549 | 1638 | if (empty($cacheusers[$tmpid])) {
|
| 1550 | 1639 | $newuser = new User($db); |
@@ -1556,8 +1645,9 @@ discard block |
||
| 1556 | 1645 | } |
| 1557 | 1646 | print $listofusertoshow; |
| 1558 | 1647 | |
| 1559 | - if ($event->type_code == 'ICALEVENT') |
|
| 1560 | - print '<br>(' . dol_trunc($event->icalname, $maxnbofchar) . ')';
|
|
| 1648 | + if ($event->type_code == 'ICALEVENT') { |
|
| 1649 | + print '<br>(' . dol_trunc($event->icalname, $maxnbofchar) . ')'; |
|
| 1650 | + } |
|
| 1561 | 1651 | |
| 1562 | 1652 | // If action related to company / contact |
| 1563 | 1653 | $linerelatedto = ''; |
@@ -1566,31 +1656,38 @@ discard block |
||
| 1566 | 1656 | $thirdparty = new Societe($db); |
| 1567 | 1657 | $thirdparty->fetch($event->societe->id); |
| 1568 | 1658 | $cachethirdparties[$event->societe->id] = $thirdparty; |
| 1569 | - } else |
|
| 1570 | - $thirdparty = $cachethirdparties[$event->societe->id]; |
|
| 1571 | - if (!empty($thirdparty->id)) |
|
| 1572 | - $linerelatedto .= $thirdparty->getNomUrl(1, '', 0); |
|
| 1659 | + } else { |
|
| 1660 | + $thirdparty = $cachethirdparties[$event->societe->id]; |
|
| 1661 | + } |
|
| 1662 | + if (!empty($thirdparty->id)) { |
|
| 1663 | + $linerelatedto .= $thirdparty->getNomUrl(1, '', 0); |
|
| 1664 | + } |
|
| 1573 | 1665 | } |
| 1574 | 1666 | if (!empty($event->contact->id) && $event->contact->id > 0) {
|
| 1575 | 1667 | if (!is_object($cachecontacts[$event->contact->id])) {
|
| 1576 | 1668 | $contact = new Contact($db); |
| 1577 | 1669 | $contact->fetch($event->contact->id); |
| 1578 | 1670 | $cachecontacts[$event->contact->id] = $contact; |
| 1579 | - } else |
|
| 1580 | - $contact = $cachecontacts[$event->contact->id]; |
|
| 1581 | - if ($linerelatedto) |
|
| 1582 | - $linerelatedto .= ' '; |
|
| 1583 | - if (!empty($contact->id)) |
|
| 1584 | - $linerelatedto .= $contact->getNomUrl(1, '', 0); |
|
| 1671 | + } else { |
|
| 1672 | + $contact = $cachecontacts[$event->contact->id]; |
|
| 1673 | + } |
|
| 1674 | + if ($linerelatedto) { |
|
| 1675 | + $linerelatedto .= ' '; |
|
| 1676 | + } |
|
| 1677 | + if (!empty($contact->id)) { |
|
| 1678 | + $linerelatedto .= $contact->getNomUrl(1, '', 0); |
|
| 1679 | + } |
|
| 1585 | 1680 | } |
| 1586 | 1681 | if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && !empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) {
|
| 1587 | 1682 | include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
| 1588 | - if ($linerelatedto) |
|
| 1589 | - $linerelatedto .= '<br>'; |
|
| 1683 | + if ($linerelatedto) { |
|
| 1684 | + $linerelatedto .= '<br>'; |
|
| 1685 | + } |
|
| 1590 | 1686 | $linerelatedto .= dolGetElementUrl($event->fk_element, $event->elementtype, 1); |
| 1591 | 1687 | } |
| 1592 | - if ($linerelatedto) |
|
| 1593 | - print '<br>' . $linerelatedto; |
|
| 1688 | + if ($linerelatedto) { |
|
| 1689 | + print '<br>' . $linerelatedto; |
|
| 1690 | + } |
|
| 1594 | 1691 | } |
| 1595 | 1692 | |
| 1596 | 1693 | // Show location |
@@ -1606,19 +1703,20 @@ discard block |
||
| 1606 | 1703 | $withstatus = 0; |
| 1607 | 1704 | if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
|
| 1608 | 1705 | $withstatus = 1; |
| 1609 | - if ($event->percentage >= 0) |
|
| 1610 | - $withstatus = 2; |
|
| 1706 | + if ($event->percentage >= 0) { |
|
| 1707 | + $withstatus = 2; |
|
| 1708 | + } |
|
| 1611 | 1709 | } |
| 1612 | 1710 | print '<td class="nobottom right nowrap cal_event_right' . ($withstatus >= 2 ? ' cal_event_right_status' : '') . '">'; |
| 1613 | - if ($withstatus) |
|
| 1614 | - print $event->getLibStatut(3, 1); |
|
| 1615 | - else |
|
| 1616 | - print ' '; |
|
| 1711 | + if ($withstatus) { |
|
| 1712 | + print $event->getLibStatut(3, 1); |
|
| 1713 | + } else { |
|
| 1714 | + print ' '; |
|
| 1715 | + } |
|
| 1617 | 1716 | print '</td></tr></table>'; |
| 1618 | 1717 | print '</div><!-- end event ' . $i . ' -->' . "\n"; |
| 1619 | 1718 | $i++; |
| 1620 | - } |
|
| 1621 | - else {
|
|
| 1719 | + } else {
|
|
| 1622 | 1720 | print '<a href="' . DOL_URL_ROOT . '/comm/action/index.php?action=' . $action . '&maxprint=0&month=' . $monthshown . '&year=' . $year; |
| 1623 | 1721 | print ($status ? '&status=' . $status : '') . ($filter ? '&filter=' . $filter : ''); |
| 1624 | 1722 | print ($filtert ? '&filtert=' . $filtert : ''); |
@@ -1635,8 +1733,9 @@ discard block |
||
| 1635 | 1733 | break; |
| 1636 | 1734 | } |
| 1637 | 1735 | } |
| 1638 | - if (!$i) |
|
| 1639 | - print ' '; |
|
| 1736 | + if (!$i) { |
|
| 1737 | + print ' '; |
|
| 1738 | + } |
|
| 1640 | 1739 | |
| 1641 | 1740 | if (!empty($conf->global->MAIN_JS_SWITCH_AGENDA) && $i > $maxprint && $maxprint) {
|
| 1642 | 1741 | print '<div id="more_' . $ymd . '">' . img_picto("all", "1downarrow_selected.png") . ' +' . $langs->trans("More") . '...</div>';
|
@@ -26,24 +26,24 @@ discard block |
||
| 26 | 26 | * You should have received a copy of the GNU General Public License |
| 27 | 27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 28 | 28 | */ |
| 29 | -require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php'; |
|
| 29 | +require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php'; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * \file htdocs/admin/dict.php |
| 33 | 33 | * \ingroup setup |
| 34 | 34 | * \brief Page to administer data tables |
| 35 | 35 | */ |
| 36 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 36 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 37 | 37 | |
| 38 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php'; |
|
| 39 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; |
|
| 41 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 42 | -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 43 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
| 38 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; |
|
| 39 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
|
| 41 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 42 | +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 43 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
| 44 | 44 | |
| 45 | 45 | if (!empty($conf->accounting->enabled)) { |
| 46 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; |
|
| 46 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Load translation files required by the page |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $allowed = $user->admin; |
| 60 | 60 | if ($id == 7 && !empty($user->rights->accounting->chartofaccount)) { |
| 61 | - $allowed = 1; // Tax page allowed to manager of chart account |
|
| 61 | + $allowed = 1; // Tax page allowed to manager of chart account |
|
| 62 | 62 | }if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) { |
| 63 | - $allowed = 1; // Vat page allowed to manager of chart account |
|
| 63 | + $allowed = 1; // Vat page allowed to manager of chart account |
|
| 64 | 64 | }if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) { |
| 65 | - $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account |
|
| 65 | + $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account |
|
| 66 | 66 | }if (!$allowed) { |
| 67 | 67 | accessforbidden(); |
| 68 | 68 | } |
@@ -102,42 +102,42 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // Name of SQL tables of dictionaries |
| 104 | 104 | $tabname = array(); |
| 105 | -$tabname[1] = MAIN_DB_PREFIX . "c_forme_juridique"; |
|
| 106 | -$tabname[2] = MAIN_DB_PREFIX . "c_departements"; |
|
| 107 | -$tabname[3] = MAIN_DB_PREFIX . "c_regions"; |
|
| 108 | -$tabname[4] = MAIN_DB_PREFIX . "c_country"; |
|
| 109 | -$tabname[5] = MAIN_DB_PREFIX . "c_civility"; |
|
| 110 | -$tabname[6] = MAIN_DB_PREFIX . "c_actioncomm"; |
|
| 111 | -$tabname[7] = MAIN_DB_PREFIX . "c_chargesociales"; |
|
| 112 | -$tabname[8] = MAIN_DB_PREFIX . "c_typent"; |
|
| 113 | -$tabname[9] = MAIN_DB_PREFIX . "c_currencies"; |
|
| 114 | -$tabname[10] = MAIN_DB_PREFIX . "c_tva"; |
|
| 115 | -$tabname[11] = MAIN_DB_PREFIX . "c_type_contact"; |
|
| 116 | -$tabname[12] = MAIN_DB_PREFIX . "c_payment_term"; |
|
| 117 | -$tabname[13] = MAIN_DB_PREFIX . "c_paiement"; |
|
| 118 | -$tabname[14] = MAIN_DB_PREFIX . "c_ecotaxe"; |
|
| 119 | -$tabname[15] = MAIN_DB_PREFIX . "c_paper_format"; |
|
| 120 | -$tabname[16] = MAIN_DB_PREFIX . "c_prospectlevel"; |
|
| 121 | -$tabname[17] = MAIN_DB_PREFIX . "c_type_fees"; |
|
| 122 | -$tabname[18] = MAIN_DB_PREFIX . "c_shipment_mode"; |
|
| 123 | -$tabname[19] = MAIN_DB_PREFIX . "c_effectif"; |
|
| 124 | -$tabname[20] = MAIN_DB_PREFIX . "c_input_method"; |
|
| 125 | -$tabname[21] = MAIN_DB_PREFIX . "c_availability"; |
|
| 126 | -$tabname[22] = MAIN_DB_PREFIX . "c_input_reason"; |
|
| 127 | -$tabname[23] = MAIN_DB_PREFIX . "c_revenuestamp"; |
|
| 128 | -$tabname[24] = MAIN_DB_PREFIX . "c_type_resource"; |
|
| 129 | -$tabname[25] = MAIN_DB_PREFIX . "c_type_container"; |
|
| 130 | -$tabname[26] = MAIN_DB_PREFIX . "c_units"; |
|
| 131 | -$tabname[27] = MAIN_DB_PREFIX . "c_stcomm"; |
|
| 132 | -$tabname[28] = MAIN_DB_PREFIX . "c_holiday_types"; |
|
| 133 | -$tabname[29] = MAIN_DB_PREFIX . "c_lead_status"; |
|
| 134 | -$tabname[30] = MAIN_DB_PREFIX . "c_format_cards"; |
|
| 105 | +$tabname[1] = MAIN_DB_PREFIX."c_forme_juridique"; |
|
| 106 | +$tabname[2] = MAIN_DB_PREFIX."c_departements"; |
|
| 107 | +$tabname[3] = MAIN_DB_PREFIX."c_regions"; |
|
| 108 | +$tabname[4] = MAIN_DB_PREFIX."c_country"; |
|
| 109 | +$tabname[5] = MAIN_DB_PREFIX."c_civility"; |
|
| 110 | +$tabname[6] = MAIN_DB_PREFIX."c_actioncomm"; |
|
| 111 | +$tabname[7] = MAIN_DB_PREFIX."c_chargesociales"; |
|
| 112 | +$tabname[8] = MAIN_DB_PREFIX."c_typent"; |
|
| 113 | +$tabname[9] = MAIN_DB_PREFIX."c_currencies"; |
|
| 114 | +$tabname[10] = MAIN_DB_PREFIX."c_tva"; |
|
| 115 | +$tabname[11] = MAIN_DB_PREFIX."c_type_contact"; |
|
| 116 | +$tabname[12] = MAIN_DB_PREFIX."c_payment_term"; |
|
| 117 | +$tabname[13] = MAIN_DB_PREFIX."c_paiement"; |
|
| 118 | +$tabname[14] = MAIN_DB_PREFIX."c_ecotaxe"; |
|
| 119 | +$tabname[15] = MAIN_DB_PREFIX."c_paper_format"; |
|
| 120 | +$tabname[16] = MAIN_DB_PREFIX."c_prospectlevel"; |
|
| 121 | +$tabname[17] = MAIN_DB_PREFIX."c_type_fees"; |
|
| 122 | +$tabname[18] = MAIN_DB_PREFIX."c_shipment_mode"; |
|
| 123 | +$tabname[19] = MAIN_DB_PREFIX."c_effectif"; |
|
| 124 | +$tabname[20] = MAIN_DB_PREFIX."c_input_method"; |
|
| 125 | +$tabname[21] = MAIN_DB_PREFIX."c_availability"; |
|
| 126 | +$tabname[22] = MAIN_DB_PREFIX."c_input_reason"; |
|
| 127 | +$tabname[23] = MAIN_DB_PREFIX."c_revenuestamp"; |
|
| 128 | +$tabname[24] = MAIN_DB_PREFIX."c_type_resource"; |
|
| 129 | +$tabname[25] = MAIN_DB_PREFIX."c_type_container"; |
|
| 130 | +$tabname[26] = MAIN_DB_PREFIX."c_units"; |
|
| 131 | +$tabname[27] = MAIN_DB_PREFIX."c_stcomm"; |
|
| 132 | +$tabname[28] = MAIN_DB_PREFIX."c_holiday_types"; |
|
| 133 | +$tabname[29] = MAIN_DB_PREFIX."c_lead_status"; |
|
| 134 | +$tabname[30] = MAIN_DB_PREFIX."c_format_cards"; |
|
| 135 | 135 | //$tabname[31]= MAIN_DB_PREFIX."accounting_system"; |
| 136 | 136 | //$tabname[32]= MAIN_DB_PREFIX."c_accounting_category"; |
| 137 | -$tabname[33] = MAIN_DB_PREFIX . "c_hrm_department"; |
|
| 138 | -$tabname[34] = MAIN_DB_PREFIX . "c_hrm_function"; |
|
| 139 | -$tabname[35] = MAIN_DB_PREFIX . "c_exp_tax_cat"; |
|
| 140 | -$tabname[36] = MAIN_DB_PREFIX . "c_exp_tax_range"; |
|
| 137 | +$tabname[33] = MAIN_DB_PREFIX."c_hrm_department"; |
|
| 138 | +$tabname[34] = MAIN_DB_PREFIX."c_hrm_function"; |
|
| 139 | +$tabname[35] = MAIN_DB_PREFIX."c_exp_tax_cat"; |
|
| 140 | +$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range"; |
|
| 141 | 141 | |
| 142 | 142 | // Dictionary labels |
| 143 | 143 | $tablib = array(); |
@@ -180,42 +180,42 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // Requests to extract data |
| 182 | 182 | $tabsql = array(); |
| 183 | -$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM " . MAIN_DB_PREFIX . "c_forme_juridique as f, " . MAIN_DB_PREFIX . "c_country as c WHERE f.fk_pays=c.rowid"; |
|
| 184 | -$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM " . MAIN_DB_PREFIX . "c_departements as d, " . MAIN_DB_PREFIX . "c_regions as r, " . MAIN_DB_PREFIX . "c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; |
|
| 185 | -$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM " . MAIN_DB_PREFIX . "c_regions as r, " . MAIN_DB_PREFIX . "c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; |
|
| 186 | -$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM " . MAIN_DB_PREFIX . "c_country AS c"; |
|
| 187 | -$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM " . MAIN_DB_PREFIX . "c_civility AS c"; |
|
| 188 | -$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM " . MAIN_DB_PREFIX . "c_actioncomm AS a"; |
|
| 189 | -$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM " . MAIN_DB_PREFIX . "c_chargesociales AS a, " . MAIN_DB_PREFIX . "c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; |
|
| 190 | -$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM " . MAIN_DB_PREFIX . "c_typent as t LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON t.fk_country=c.rowid"; |
|
| 191 | -$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM " . MAIN_DB_PREFIX . "c_currencies AS c"; |
|
| 192 | -$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c WHERE t.fk_pays=c.rowid"; |
|
| 193 | -$tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM " . MAIN_DB_PREFIX . "c_type_contact AS t"; |
|
| 194 | -$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM " . MAIN_DB_PREFIX . "c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]); |
|
| 195 | -$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM " . MAIN_DB_PREFIX . "c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]); |
|
| 196 | -$tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM " . MAIN_DB_PREFIX . "c_ecotaxe AS e, " . MAIN_DB_PREFIX . "c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; |
|
| 197 | -$tabsql[15] = "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM " . MAIN_DB_PREFIX . "c_paper_format"; |
|
| 198 | -$tabsql[16] = "SELECT code, label as libelle, sortorder, active FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; |
|
| 199 | -$tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FROM " . MAIN_DB_PREFIX . "c_type_fees"; |
|
| 200 | -$tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM " . MAIN_DB_PREFIX . "c_shipment_mode"; |
|
| 201 | -$tabsql[19] = "SELECT id as rowid, code, libelle, active FROM " . MAIN_DB_PREFIX . "c_effectif"; |
|
| 202 | -$tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM " . MAIN_DB_PREFIX . "c_input_method"; |
|
| 203 | -$tabsql[21] = "SELECT c.rowid as rowid, code, label, active FROM " . MAIN_DB_PREFIX . "c_availability AS c"; |
|
| 204 | -$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM " . MAIN_DB_PREFIX . "c_input_reason"; |
|
| 205 | -$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM " . MAIN_DB_PREFIX . "c_revenuestamp as t, " . MAIN_DB_PREFIX . "c_country as c WHERE t.fk_pays=c.rowid"; |
|
| 206 | -$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM " . MAIN_DB_PREFIX . "c_type_resource"; |
|
| 207 | -$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM " . MAIN_DB_PREFIX . "c_type_container as t WHERE t.entity IN (" . getEntity('c_type_container') . ")"; |
|
| 208 | -$tabsql[26] = "SELECT rowid as rowid, code, label, short_label, active FROM " . MAIN_DB_PREFIX . "c_units"; |
|
| 209 | -$tabsql[27] = "SELECT id as rowid, code, libelle, active FROM " . MAIN_DB_PREFIX . "c_stcomm"; |
|
| 210 | -$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM " . MAIN_DB_PREFIX . "c_holiday_types as h LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON h.fk_country=c.rowid"; |
|
| 211 | -$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM " . MAIN_DB_PREFIX . "c_lead_status"; |
|
| 212 | -$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM " . MAIN_DB_PREFIX . "c_format_cards"; |
|
| 183 | +$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; |
|
| 184 | +$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; |
|
| 185 | +$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; |
|
| 186 | +$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c"; |
|
| 187 | +$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; |
|
| 188 | +$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; |
|
| 189 | +$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; |
|
| 190 | +$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; |
|
| 191 | +$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; |
|
| 192 | +$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; |
|
| 193 | +$tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; |
|
| 194 | +$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]); |
|
| 195 | +$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]); |
|
| 196 | +$tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; |
|
| 197 | +$tabsql[15] = "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; |
|
| 198 | +$tabsql[16] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; |
|
| 199 | +$tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FROM ".MAIN_DB_PREFIX."c_type_fees"; |
|
| 200 | +$tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode"; |
|
| 201 | +$tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif"; |
|
| 202 | +$tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method"; |
|
| 203 | +$tabsql[21] = "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c"; |
|
| 204 | +$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; |
|
| 205 | +$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; |
|
| 206 | +$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; |
|
| 207 | +$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")"; |
|
| 208 | +$tabsql[26] = "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; |
|
| 209 | +$tabsql[27] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm"; |
|
| 210 | +$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; |
|
| 211 | +$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; |
|
| 212 | +$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; |
|
| 213 | 213 | //$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; |
| 214 | 214 | //$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; |
| 215 | -$tabsql[33] = "SELECT rowid, pos, code, label, active FROM " . MAIN_DB_PREFIX . "c_hrm_department"; |
|
| 216 | -$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM " . MAIN_DB_PREFIX . "c_hrm_function"; |
|
| 217 | -$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM " . MAIN_DB_PREFIX . "c_exp_tax_cat c"; |
|
| 218 | -$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM " . MAIN_DB_PREFIX . "c_exp_tax_range r"; |
|
| 215 | +$tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; |
|
| 216 | +$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; |
|
| 217 | +$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c"; |
|
| 218 | +$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r"; |
|
| 219 | 219 | |
| 220 | 220 | // Criteria to sort dictionaries |
| 221 | 221 | $tabsqlsort = array(); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $tabsqlsort[5] = "label ASC"; |
| 227 | 227 | $tabsqlsort[6] = "a.type ASC, a.module ASC, a.position ASC, a.code ASC"; |
| 228 | 228 | $tabsqlsort[7] = "country ASC, code ASC, a.libelle ASC"; |
| 229 | -$tabsqlsort[8] = "country DESC," . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ' t.position ASC,' : '') . " libelle ASC"; |
|
| 229 | +$tabsqlsort[8] = "country DESC,".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ' t.position ASC,' : '')." libelle ASC"; |
|
| 230 | 230 | $tabsqlsort[9] = "label ASC"; |
| 231 | 231 | $tabsqlsort[10] = "country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC"; |
| 232 | 232 | $tabsqlsort[11] = "t.element ASC, t.source ASC, t.position ASC, t.code ASC"; |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | // Nom des champs en resultat de select pour affichage du dictionnaire |
| 260 | 260 | $tabfield = array(); |
| 261 | 261 | $tabfield[1] = "code,libelle,country"; |
| 262 | -$tabfield[2] = "code,libelle,region_id,region,country"; // "code,libelle,region,country_code-country" |
|
| 262 | +$tabfield[2] = "code,libelle,region_id,region,country"; // "code,libelle,region,country_code-country" |
|
| 263 | 263 | $tabfield[3] = "code,libelle,country_id,country"; |
| 264 | 264 | $tabfield[4] = "code,label"; |
| 265 | 265 | $tabfield[5] = "code,label"; |
| 266 | 266 | $tabfield[6] = "code,libelle,type,color,position"; |
| 267 | 267 | $tabfield[7] = "code,libelle,country,accountancy_code,deductible"; |
| 268 | -$tabfield[8] = "code,libelle,country_id,country" . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); |
|
| 268 | +$tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); |
|
| 269 | 269 | $tabfield[9] = "code,label,unicode"; |
| 270 | 270 | $tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; |
| 271 | 271 | $tabfield[11] = "element,source,code,libelle,position"; |
@@ -298,13 +298,13 @@ discard block |
||
| 298 | 298 | // Nom des champs d'edition pour modification d'un enregistrement |
| 299 | 299 | $tabfieldvalue = array(); |
| 300 | 300 | $tabfieldvalue[1] = "code,libelle,country"; |
| 301 | -$tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region" |
|
| 301 | +$tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region" |
|
| 302 | 302 | $tabfieldvalue[3] = "code,libelle,country"; |
| 303 | 303 | $tabfieldvalue[4] = "code,label"; |
| 304 | 304 | $tabfieldvalue[5] = "code,label"; |
| 305 | 305 | $tabfieldvalue[6] = "code,libelle,type,color,position"; |
| 306 | 306 | $tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible"; |
| 307 | -$tabfieldvalue[8] = "code,libelle,country" . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); |
|
| 307 | +$tabfieldvalue[8] = "code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); |
|
| 308 | 308 | $tabfieldvalue[9] = "code,label,unicode"; |
| 309 | 309 | $tabfieldvalue[10] = "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; |
| 310 | 310 | $tabfieldvalue[11] = "element,source,code,libelle,position"; |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $tabfieldinsert[5] = "code,label"; |
| 344 | 344 | $tabfieldinsert[6] = "code,libelle,type,color,position"; |
| 345 | 345 | $tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible"; |
| 346 | -$tabfieldinsert[8] = "code,libelle,fk_country" . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); |
|
| 346 | +$tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); |
|
| 347 | 347 | $tabfieldinsert[9] = "code_iso,label,unicode"; |
| 348 | 348 | $tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; |
| 349 | 349 | $tabfieldinsert[11] = "element,source,code,libelle,position"; |
@@ -585,12 +585,12 @@ discard block |
||
| 585 | 585 | if ($id == 10) { |
| 586 | 586 | $localtax_typeList = array( |
| 587 | 587 | "0" => $langs->trans("No"), |
| 588 | - "1" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 1)", //$langs->trans("%ageOnAllWithoutVAT"), |
|
| 589 | - "2" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 2)", //$langs->trans("%ageOnAllBeforeVAT"), |
|
| 590 | - "3" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 3)", //$langs->trans("%ageOnProductsWithoutVAT"), |
|
| 591 | - "4" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 4)", //$langs->trans("%ageOnProductsBeforeVAT"), |
|
| 592 | - "5" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 5)", //$langs->trans("%ageOnServiceWithoutVAT"), |
|
| 593 | - "6" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 6)" //$langs->trans("%ageOnServiceBeforeVAT"), |
|
| 588 | + "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), |
|
| 589 | + "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), |
|
| 590 | + "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), |
|
| 591 | + "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), |
|
| 592 | + "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), |
|
| 593 | + "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), |
|
| 594 | 594 | ); |
| 595 | 595 | } |
| 596 | 596 | |
@@ -616,9 +616,9 @@ discard block |
||
| 616 | 616 | $ok = 1; |
| 617 | 617 | foreach ($listfield as $f => $value) { |
| 618 | 618 | if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) |
| 619 | - continue; // For some pages, country is not mandatory |
|
| 619 | + continue; // For some pages, country is not mandatory |
|
| 620 | 620 | if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) |
| 621 | - continue; // For some pages, country is not mandatory |
|
| 621 | + continue; // For some pages, country is not mandatory |
|
| 622 | 622 | if ($value == 'localtax1' && empty($_POST['localtax1_type'])) |
| 623 | 623 | continue; |
| 624 | 624 | if ($value == 'localtax2' && empty($_POST['localtax2_type'])) |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | if ($value == 'formula' && empty($_POST['formula'])) |
| 629 | 629 | continue; |
| 630 | 630 | if ($value == 'sortorder') |
| 631 | - continue; // For a column name 'sortorder', we use the field name 'position' |
|
| 631 | + continue; // For a column name 'sortorder', we use the field name 'position' |
|
| 632 | 632 | if ((!isset($_POST[$value]) || $_POST[$value] == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking')) // Fields that are not mandatory |
| 633 | 633 | && (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 |
| 634 | 634 | ) |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | // Other checks |
| 674 | - if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system', 'systemauto'))) { |
|
| 674 | + if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system', 'systemauto'))) { |
|
| 675 | 675 | $ok = 0; |
| 676 | 676 | setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); |
| 677 | 677 | } |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | if ($tabrowid[$id]) { |
| 720 | 720 | // Recupere id libre pour insertion |
| 721 | 721 | $newid = 0; |
| 722 | - $sql = "SELECT max(" . $tabrowid[$id] . ") newid from " . $tabname[$id]; |
|
| 722 | + $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; |
|
| 723 | 723 | $result = $db->query($sql); |
| 724 | 724 | if ($result) { |
| 725 | 725 | $obj = $db->fetch_object($result); |
@@ -730,17 +730,17 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | // Add new entry |
| 733 | - $sql = "INSERT INTO " . $tabname[$id] . " ("; |
|
| 733 | + $sql = "INSERT INTO ".$tabname[$id]." ("; |
|
| 734 | 734 | // List of fields |
| 735 | 735 | if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) |
| 736 | - $sql .= $tabrowid[$id] . ","; |
|
| 736 | + $sql .= $tabrowid[$id].","; |
|
| 737 | 737 | $sql .= $tabfieldinsert[$id]; |
| 738 | 738 | $sql .= ",active)"; |
| 739 | 739 | $sql .= " VALUES("; |
| 740 | 740 | |
| 741 | 741 | // List of values |
| 742 | 742 | if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) |
| 743 | - $sql .= $newid . ","; |
|
| 743 | + $sql .= $newid.","; |
|
| 744 | 744 | $i = 0; |
| 745 | 745 | foreach ($listfieldinsert as $f => $value) { |
| 746 | 746 | if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') { |
@@ -751,11 +751,11 @@ discard block |
||
| 751 | 751 | if ($i) |
| 752 | 752 | $sql .= ","; |
| 753 | 753 | if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' |
| 754 | - $sql .= "'" . (int) $db->escape($_POST['position']) . "'"; |
|
| 754 | + $sql .= "'".(int) $db->escape($_POST['position'])."'"; |
|
| 755 | 755 | } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) |
| 756 | - $sql .= "null"; // For vat, we want/accept code = '' |
|
| 756 | + $sql .= "null"; // For vat, we want/accept code = '' |
|
| 757 | 757 | else |
| 758 | - $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'"; |
|
| 758 | + $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; |
|
| 759 | 759 | $i++; |
| 760 | 760 | } |
| 761 | 761 | $sql .= ",1)"; |
@@ -783,11 +783,11 @@ discard block |
||
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | // Modify entry |
| 786 | - $sql = "UPDATE " . $tabname[$id] . " SET "; |
|
| 786 | + $sql = "UPDATE ".$tabname[$id]." SET "; |
|
| 787 | 787 | // Modifie valeur des champs |
| 788 | 788 | if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { |
| 789 | - $sql .= $tabrowid[$id] . "="; |
|
| 790 | - $sql .= "'" . $db->escape($rowid) . "', "; |
|
| 789 | + $sql .= $tabrowid[$id]."="; |
|
| 790 | + $sql .= "'".$db->escape($rowid)."', "; |
|
| 791 | 791 | } |
| 792 | 792 | $i = 0; |
| 793 | 793 | foreach ($listfieldmodify as $field) { |
@@ -798,18 +798,18 @@ discard block |
||
| 798 | 798 | } |
| 799 | 799 | if ($i) |
| 800 | 800 | $sql .= ","; |
| 801 | - $sql .= $field . "="; |
|
| 801 | + $sql .= $field."="; |
|
| 802 | 802 | if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' |
| 803 | - $sql .= "'" . (int) $db->escape($_POST['position']) . "'"; |
|
| 803 | + $sql .= "'".(int) $db->escape($_POST['position'])."'"; |
|
| 804 | 804 | } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) |
| 805 | - $sql .= "null"; // For vat, we want/accept code = '' |
|
| 805 | + $sql .= "null"; // For vat, we want/accept code = '' |
|
| 806 | 806 | else |
| 807 | - $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'"; |
|
| 807 | + $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; |
|
| 808 | 808 | $i++; |
| 809 | 809 | } |
| 810 | - $sql .= " WHERE " . $rowidcol . " = '" . $rowid . "'"; |
|
| 810 | + $sql .= " WHERE ".$rowidcol." = '".$rowid."'"; |
|
| 811 | 811 | if (in_array('entity', $listfieldmodify)) |
| 812 | - $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'"; |
|
| 812 | + $sql .= " AND entity = '".getEntity($tabname[$id])."'"; |
|
| 813 | 813 | |
| 814 | 814 | dol_syslog("actionmodify", LOG_DEBUG); |
| 815 | 815 | //print $sql; |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | $rowidcol = "rowid"; |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | - $sql = "DELETE FROM " . $tabname[$id] . " WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 835 | + $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 836 | 836 | |
| 837 | 837 | dol_syslog("delete", LOG_DEBUG); |
| 838 | 838 | $result = $db->query($sql); |
@@ -854,9 +854,9 @@ discard block |
||
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | if ($rowid) { |
| 857 | - $sql = "UPDATE " . $tabname[$id] . " SET active = 1 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 857 | + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 858 | 858 | } elseif ($code) { |
| 859 | - $sql = "UPDATE " . $tabname[$id] . " SET active = 1 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 859 | + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | $result = $db->query($sql); |
@@ -874,9 +874,9 @@ discard block |
||
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | if ($rowid) { |
| 877 | - $sql = "UPDATE " . $tabname[$id] . " SET active = 0 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 877 | + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 878 | 878 | } elseif ($code) { |
| 879 | - $sql = "UPDATE " . $tabname[$id] . " SET active = 0 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 879 | + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | $result = $db->query($sql); |
@@ -894,9 +894,9 @@ discard block |
||
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | if ($rowid) { |
| 897 | - $sql = "UPDATE " . $tabname[$id] . " SET favorite = 1 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 897 | + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 898 | 898 | } elseif ($code) { |
| 899 | - $sql = "UPDATE " . $tabname[$id] . " SET favorite = 1 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 899 | + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | $result = $db->query($sql); |
@@ -914,9 +914,9 @@ discard block |
||
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | if ($rowid) { |
| 917 | - $sql = "UPDATE " . $tabname[$id] . " SET favorite = 0 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 917 | + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 918 | 918 | } elseif ($code) { |
| 919 | - $sql = "UPDATE " . $tabname[$id] . " SET favorite = 0 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : ''); |
|
| 919 | + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | $result = $db->query($sql); |
@@ -938,9 +938,9 @@ discard block |
||
| 938 | 938 | $titre = $langs->trans("DictionarySetup"); |
| 939 | 939 | $linkback = ''; |
| 940 | 940 | if ($id) { |
| 941 | - $titre .= ' - ' . $langs->trans($tablib[$id]); |
|
| 941 | + $titre .= ' - '.$langs->trans($tablib[$id]); |
|
| 942 | 942 | // $linkback = '<a href="' . $_SERVER['PHP_SELF'] . '">' . $langs->trans("BackToDictionaryList") . '</a>'; |
| 943 | - $linkback = '<a href="' . BASE_URI . '?controller=admin&method=dict">' . $langs->trans("BackToDictionaryList") . '</a>'; |
|
| 943 | + $linkback = '<a href="'.BASE_URI.'?controller=admin&method=dict">'.$langs->trans("BackToDictionaryList").'</a>'; |
|
| 944 | 944 | } |
| 945 | 945 | $titlepicto = 'title_setup'; |
| 946 | 946 | if ($id == 10 && GETPOST('from') == 'accountancy') { |
@@ -956,30 +956,30 @@ discard block |
||
| 956 | 956 | |
| 957 | 957 | if (empty($id)) { |
| 958 | 958 | print $langs->trans("DictionaryDesc"); |
| 959 | - print " " . $langs->trans("OnlyActiveElementsAreShown") . "<br>\n"; |
|
| 959 | + print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n"; |
|
| 960 | 960 | print '<br>'; |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | |
| 964 | -$param = '&id=' . urlencode($id); |
|
| 964 | +$param = '&id='.urlencode($id); |
|
| 965 | 965 | if ($search_country_id > 0) |
| 966 | - $param .= '&search_country_id=' . urlencode($search_country_id); |
|
| 966 | + $param .= '&search_country_id='.urlencode($search_country_id); |
|
| 967 | 967 | if ($search_code != '') |
| 968 | - $param .= '&search_code=' . urlencode($search_country_id); |
|
| 968 | + $param .= '&search_code='.urlencode($search_country_id); |
|
| 969 | 969 | if ($entity != '') |
| 970 | - $param .= '&entity=' . (int) $entity; |
|
| 970 | + $param .= '&entity='.(int) $entity; |
|
| 971 | 971 | $paramwithsearch = $param; |
| 972 | 972 | if ($sortorder) |
| 973 | - $paramwithsearch .= '&sortorder=' . urlencode($sortorder); |
|
| 973 | + $paramwithsearch .= '&sortorder='.urlencode($sortorder); |
|
| 974 | 974 | if ($sortfield) |
| 975 | - $paramwithsearch .= '&sortfield=' . urlencode($sortfield); |
|
| 975 | + $paramwithsearch .= '&sortfield='.urlencode($sortfield); |
|
| 976 | 976 | if (GETPOST('from')) |
| 977 | - $paramwithsearch .= '&from=' . urlencode(GETPOST('from', 'alpha')); |
|
| 977 | + $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); |
|
| 978 | 978 | |
| 979 | 979 | |
| 980 | 980 | // Confirmation de la suppression de la ligne |
| 981 | 981 | if ($action == 'delete') { |
| 982 | - print $form->formconfirm($_SERVER["PHP_SELF"] . '?' . ($page ? 'page=' . $page . '&' : '') . 'rowid=' . $rowid . '&code=' . urlencode($code) . $paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); |
|
| 982 | + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'rowid='.$rowid.'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); |
|
| 983 | 983 | } |
| 984 | 984 | //var_dump($elementList); |
| 985 | 985 | |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | if (!preg_match('/ WHERE /', $sql)) |
| 994 | 994 | $sql .= " WHERE 1 = 1"; |
| 995 | 995 | if ($search_country_id > 0) |
| 996 | - $sql .= " AND c.rowid = " . $search_country_id; |
|
| 996 | + $sql .= " AND c.rowid = ".$search_country_id; |
|
| 997 | 997 | if ($search_code != '' && $id != 9) |
| 998 | 998 | $sql .= natural_search("code", $search_code); |
| 999 | 999 | if ($search_code != '' && $id == 9) |
@@ -1003,14 +1003,14 @@ discard block |
||
| 1003 | 1003 | // If sort order is "country", we use country_code instead |
| 1004 | 1004 | if ($sortfield == 'country') |
| 1005 | 1005 | $sortfield = 'country_code'; |
| 1006 | - $sql .= " ORDER BY " . $db->escape($sortfield); |
|
| 1006 | + $sql .= " ORDER BY ".$db->escape($sortfield); |
|
| 1007 | 1007 | if ($sortorder) { |
| 1008 | - $sql .= " " . strtoupper($db->escape($sortorder)); |
|
| 1008 | + $sql .= " ".strtoupper($db->escape($sortorder)); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | $sql .= ", "; |
| 1011 | 1011 | // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value |
| 1012 | - $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?' . $sortfield . ' ' . $sortorder . ',/i', '', $tabsqlsort[$id]); |
|
| 1013 | - $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?' . $sortfield . ',/i', '', $tabsqlsort[$id]); |
|
| 1012 | + $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i', '', $tabsqlsort[$id]); |
|
| 1013 | + $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.',/i', '', $tabsqlsort[$id]); |
|
| 1014 | 1014 | } else { |
| 1015 | 1015 | $sql .= " ORDER BY "; |
| 1016 | 1016 | } |
@@ -1019,15 +1019,15 @@ discard block |
||
| 1019 | 1019 | //print $sql; |
| 1020 | 1020 | |
| 1021 | 1021 | if (empty($tabfield[$id])) { |
| 1022 | - dol_print_error($db, 'The table with id ' . $id . ' has no array tabfield defined'); |
|
| 1022 | + dol_print_error($db, 'The table with id '.$id.' has no array tabfield defined'); |
|
| 1023 | 1023 | exit; |
| 1024 | 1024 | } |
| 1025 | 1025 | $fieldlist = explode(',', $tabfield[$id]); |
| 1026 | 1026 | |
| 1027 | 1027 | // print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; |
| 1028 | - print '<form href="' . BASE_URI . '?controller=admin&method=dict&id=' . $id . '" method="POST">'; |
|
| 1029 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 1030 | - print '<input type="hidden" name="from" value="' . dol_escape_htmltag(GETPOST('from', 'alpha')) . '">'; |
|
| 1028 | + print '<form href="'.BASE_URI.'?controller=admin&method=dict&id='.$id.'" method="POST">'; |
|
| 1029 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1030 | + print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">'; |
|
| 1031 | 1031 | |
| 1032 | 1032 | if ($id == 10 && empty($conf->global->FACTURE_TVAOPTION)) { |
| 1033 | 1033 | print info_admin($langs->trans("VATIsUsedIsOff", $langs->transnoentities("Setup"), $langs->transnoentities("CompanyFoundation"))); |
@@ -1055,8 +1055,8 @@ discard block |
||
| 1055 | 1055 | |
| 1056 | 1056 | // Determine le nom du champ par rapport aux noms possibles |
| 1057 | 1057 | // dans les dictionnaires de donnees |
| 1058 | - $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut |
|
| 1059 | - $valuetoshow = $langs->trans($valuetoshow); // try to translate |
|
| 1058 | + $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut |
|
| 1059 | + $valuetoshow = $langs->trans($valuetoshow); // try to translate |
|
| 1060 | 1060 | $class = ''; |
| 1061 | 1061 | if ($fieldlist[$field] == 'source') { |
| 1062 | 1062 | $valuetoshow = $langs->trans("Contact"); |
@@ -1065,28 +1065,28 @@ discard block |
||
| 1065 | 1065 | $valuetoshow = $langs->trans("PriceUHT"); |
| 1066 | 1066 | } |
| 1067 | 1067 | if ($fieldlist[$field] == 'taux') { |
| 1068 | - if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") |
|
| 1068 | + if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") |
|
| 1069 | 1069 | $valuetoshow = $langs->trans("Rate"); |
| 1070 | 1070 | else |
| 1071 | 1071 | $valuetoshow = $langs->trans("Amount"); |
| 1072 | 1072 | $class = 'center'; |
| 1073 | 1073 | } |
| 1074 | 1074 | if ($fieldlist[$field] == 'localtax1_type') { |
| 1075 | - $valuetoshow = $langs->trans("UseLocalTax") . " 2"; |
|
| 1075 | + $valuetoshow = $langs->trans("UseLocalTax")." 2"; |
|
| 1076 | 1076 | $class = "center"; |
| 1077 | 1077 | $sortable = 0; |
| 1078 | 1078 | } |
| 1079 | 1079 | if ($fieldlist[$field] == 'localtax1') { |
| 1080 | - $valuetoshow = $langs->trans("Rate") . " 2"; |
|
| 1080 | + $valuetoshow = $langs->trans("Rate")." 2"; |
|
| 1081 | 1081 | $class = "center"; |
| 1082 | 1082 | } |
| 1083 | 1083 | if ($fieldlist[$field] == 'localtax2_type') { |
| 1084 | - $valuetoshow = $langs->trans("UseLocalTax") . " 3"; |
|
| 1084 | + $valuetoshow = $langs->trans("UseLocalTax")." 3"; |
|
| 1085 | 1085 | $class = "center"; |
| 1086 | 1086 | $sortable = 0; |
| 1087 | 1087 | } |
| 1088 | 1088 | if ($fieldlist[$field] == 'localtax2') { |
| 1089 | - $valuetoshow = $langs->trans("Rate") . " 3"; |
|
| 1089 | + $valuetoshow = $langs->trans("Rate")." 3"; |
|
| 1090 | 1090 | $class = "center"; |
| 1091 | 1091 | } |
| 1092 | 1092 | if ($fieldlist[$field] == 'organization') { |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | $valuetoshow = $langs->trans("Language"); |
| 1097 | 1097 | } |
| 1098 | 1098 | if ($fieldlist[$field] == 'type') { |
| 1099 | - if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement") |
|
| 1099 | + if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") |
|
| 1100 | 1100 | $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); |
| 1101 | 1101 | else |
| 1102 | 1102 | $valuetoshow = $langs->trans("Type"); |
@@ -1241,15 +1241,15 @@ discard block |
||
| 1241 | 1241 | $showfield = 1; |
| 1242 | 1242 | } |
| 1243 | 1243 | if ($fieldlist[$field] == 'region') { |
| 1244 | - $valuetoshow = $langs->trans("Country") . '/' . $langs->trans("Region"); |
|
| 1244 | + $valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region"); |
|
| 1245 | 1245 | $showfield = 1; |
| 1246 | 1246 | } |
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | if ($valuetoshow != '') { |
| 1250 | - print '<td' . ($class ? ' class="' . $class . '"' : '') . '>'; |
|
| 1250 | + print '<td'.($class ? ' class="'.$class.'"' : '').'>'; |
|
| 1251 | 1251 | if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) |
| 1252 | - print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>'; |
|
| 1252 | + print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>'; |
|
| 1253 | 1253 | else if (!empty($tabhelp[$id][$value])) |
| 1254 | 1254 | print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); |
| 1255 | 1255 | else |
@@ -1263,9 +1263,9 @@ discard block |
||
| 1263 | 1263 | if ($id == 4) |
| 1264 | 1264 | print '<td></td>'; |
| 1265 | 1265 | print '<td>'; |
| 1266 | - print '<input type="hidden" name="id" value="' . $id . '">'; |
|
| 1266 | + print '<input type="hidden" name="id" value="'.$id.'">'; |
|
| 1267 | 1267 | if (!is_null($withentity)) |
| 1268 | - print '<input type="hidden" name="entity" value="' . $withentity . '">'; |
|
| 1268 | + print '<input type="hidden" name="entity" value="'.$withentity.'">'; |
|
| 1269 | 1269 | print '</td>'; |
| 1270 | 1270 | print '<td style="min-width: 26px;"></td>'; |
| 1271 | 1271 | print '<td style="min-width: 26px;"></td>'; |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | |
| 1286 | 1286 | $tmpaction = 'create'; |
| 1287 | 1287 | $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); |
| 1288 | - $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 1288 | + $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 1289 | 1289 | $error = $hookmanager->error; |
| 1290 | 1290 | $errors = $hookmanager->errors; |
| 1291 | 1291 | |
@@ -1300,7 +1300,7 @@ discard block |
||
| 1300 | 1300 | print '<td></td>'; |
| 1301 | 1301 | print '<td colspan="3" align="center">'; |
| 1302 | 1302 | if ($action != 'edit') { |
| 1303 | - print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">'; |
|
| 1303 | + print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">'; |
|
| 1304 | 1304 | } |
| 1305 | 1305 | print '</td>'; |
| 1306 | 1306 | print "</tr>"; |
@@ -1318,9 +1318,9 @@ discard block |
||
| 1318 | 1318 | print '<br>'; |
| 1319 | 1319 | |
| 1320 | 1320 | // print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; |
| 1321 | - print '<form href="' . BASE_URI . '?controller=admin&method=dict&id=' . $id . '" method="POST">'; |
|
| 1322 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 1323 | - print '<input type="hidden" name="from" value="' . dol_escape_htmltag(GETPOST('from', 'alpha')) . '">'; |
|
| 1321 | + print '<form href="'.BASE_URI.'?controller=admin&method=dict&id='.$id.'" method="POST">'; |
|
| 1322 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1323 | + print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">'; |
|
| 1324 | 1324 | |
| 1325 | 1325 | // List of available record in database |
| 1326 | 1326 | dol_syslog("htdocs/admin/dict", LOG_DEBUG); |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | // There is several pages |
| 1333 | 1333 | if ($num > $listlimit || $page) { |
| 1334 | - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>' . $langs->trans("Page") . ' ' . ($page + 1) . '</span></li>'); |
|
| 1334 | + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>'); |
|
| 1335 | 1335 | print '<div class="clearboth"></div>'; |
| 1336 | 1336 | } |
| 1337 | 1337 | |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | $filterfound++; |
| 1360 | 1360 | } elseif ($value == 'code') { |
| 1361 | 1361 | print '<td class="liste_titre">'; |
| 1362 | - print '<input type="text" class="maxwidth100" name="search_code" value="' . dol_escape_htmltag($search_code) . '">'; |
|
| 1362 | + print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">'; |
|
| 1363 | 1363 | print '</td>'; |
| 1364 | 1364 | $filterfound++; |
| 1365 | 1365 | } else { |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | |
| 1388 | 1388 | // Determine le nom du champ par rapport aux noms possibles |
| 1389 | 1389 | // dans les dictionnaires de donnees |
| 1390 | - $showfield = 1; // By defaut |
|
| 1390 | + $showfield = 1; // By defaut |
|
| 1391 | 1391 | $align = "left"; |
| 1392 | 1392 | $sortable = 1; |
| 1393 | 1393 | $valuetoshow = ''; |
@@ -1398,8 +1398,8 @@ discard block |
||
| 1398 | 1398 | $align=$tmp['align']; |
| 1399 | 1399 | $sortable=$tmp['sortable']; |
| 1400 | 1400 | */ |
| 1401 | - $valuetoshow = ucfirst($fieldlist[$field]); // By defaut |
|
| 1402 | - $valuetoshow = $langs->trans($valuetoshow); // try to translate |
|
| 1401 | + $valuetoshow = ucfirst($fieldlist[$field]); // By defaut |
|
| 1402 | + $valuetoshow = $langs->trans($valuetoshow); // try to translate |
|
| 1403 | 1403 | if ($fieldlist[$field] == 'source') { |
| 1404 | 1404 | $valuetoshow = $langs->trans("Contact"); |
| 1405 | 1405 | } |
@@ -1407,29 +1407,29 @@ discard block |
||
| 1407 | 1407 | $valuetoshow = $langs->trans("PriceUHT"); |
| 1408 | 1408 | } |
| 1409 | 1409 | if ($fieldlist[$field] == 'taux') { |
| 1410 | - if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") |
|
| 1410 | + if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") |
|
| 1411 | 1411 | $valuetoshow = $langs->trans("Rate"); |
| 1412 | 1412 | else |
| 1413 | 1413 | $valuetoshow = $langs->trans("Amount"); |
| 1414 | 1414 | $align = 'center'; |
| 1415 | 1415 | } |
| 1416 | 1416 | if ($fieldlist[$field] == 'localtax1_type') { |
| 1417 | - $valuetoshow = $langs->trans("UseLocalTax") . " 2"; |
|
| 1417 | + $valuetoshow = $langs->trans("UseLocalTax")." 2"; |
|
| 1418 | 1418 | $align = "center"; |
| 1419 | 1419 | $sortable = 0; |
| 1420 | 1420 | } |
| 1421 | 1421 | if ($fieldlist[$field] == 'localtax1') { |
| 1422 | - $valuetoshow = $langs->trans("Rate") . " 2"; |
|
| 1422 | + $valuetoshow = $langs->trans("Rate")." 2"; |
|
| 1423 | 1423 | $align = "center"; |
| 1424 | 1424 | $sortable = 0; |
| 1425 | 1425 | } |
| 1426 | 1426 | if ($fieldlist[$field] == 'localtax2_type') { |
| 1427 | - $valuetoshow = $langs->trans("UseLocalTax") . " 3"; |
|
| 1427 | + $valuetoshow = $langs->trans("UseLocalTax")." 3"; |
|
| 1428 | 1428 | $align = "center"; |
| 1429 | 1429 | $sortable = 0; |
| 1430 | 1430 | } |
| 1431 | 1431 | if ($fieldlist[$field] == 'localtax2') { |
| 1432 | - $valuetoshow = $langs->trans("Rate") . " 3"; |
|
| 1432 | + $valuetoshow = $langs->trans("Rate")." 3"; |
|
| 1433 | 1433 | $align = "center"; |
| 1434 | 1434 | $sortable = 0; |
| 1435 | 1435 | } |
@@ -1579,14 +1579,14 @@ discard block |
||
| 1579 | 1579 | |
| 1580 | 1580 | // Affiche nom du champ |
| 1581 | 1581 | if ($showfield) { |
| 1582 | - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page=' . $page . '&' : ''), $param, "align=" . $align, $sortfield, $sortorder); |
|
| 1582 | + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder); |
|
| 1583 | 1583 | } |
| 1584 | 1584 | } |
| 1585 | 1585 | // Favorite - Only activated on country dictionary |
| 1586 | 1586 | if ($id == 4) |
| 1587 | - print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 1587 | + print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 1588 | 1588 | |
| 1589 | - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 1589 | + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 1590 | 1590 | print getTitleFieldOfList(''); |
| 1591 | 1591 | print getTitleFieldOfList(''); |
| 1592 | 1592 | print '</tr>'; |
@@ -1596,11 +1596,11 @@ discard block |
||
| 1596 | 1596 | while ($i < $num) { |
| 1597 | 1597 | $obj = $db->fetch_object($resql); |
| 1598 | 1598 | //print_r($obj); |
| 1599 | - print '<tr class="oddeven" id="rowid-' . $obj->rowid . '">'; |
|
| 1599 | + print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; |
|
| 1600 | 1600 | if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { |
| 1601 | 1601 | $tmpaction = 'edit'; |
| 1602 | 1602 | $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); |
| 1603 | - $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 1603 | + $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 1604 | 1604 | $error = $hookmanager->error; |
| 1605 | 1605 | $errors = $hookmanager->errors; |
| 1606 | 1606 | |
@@ -1610,19 +1610,19 @@ discard block |
||
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | print '<td colspan="3" align="center">'; |
| 1613 | - print '<div name="' . (!empty($obj->rowid) ? $obj->rowid : $obj->code) . '"></div>'; |
|
| 1614 | - print '<input type="hidden" name="page" value="' . $page . '">'; |
|
| 1615 | - print '<input type="hidden" name="rowid" value="' . $rowid . '">'; |
|
| 1613 | + print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>'; |
|
| 1614 | + print '<input type="hidden" name="page" value="'.$page.'">'; |
|
| 1615 | + print '<input type="hidden" name="rowid" value="'.$rowid.'">'; |
|
| 1616 | 1616 | if (!is_null($withentity)) |
| 1617 | - print '<input type="hidden" name="entity" value="' . $withentity . '">'; |
|
| 1618 | - print '<input type="submit" class="button" name="actionmodify" value="' . $langs->trans("Modify") . '">'; |
|
| 1619 | - print '<input type="submit" class="button" name="actioncancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 1617 | + print '<input type="hidden" name="entity" value="'.$withentity.'">'; |
|
| 1618 | + print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; |
|
| 1619 | + print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; |
|
| 1620 | 1620 | print '</td>'; |
| 1621 | 1621 | } |
| 1622 | 1622 | else { |
| 1623 | 1623 | $tmpaction = 'view'; |
| 1624 | 1624 | $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); |
| 1625 | - $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 1625 | + $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 1626 | 1626 | |
| 1627 | 1627 | $error = $hookmanager->error; |
| 1628 | 1628 | $errors = $hookmanager->errors; |
@@ -1651,8 +1651,8 @@ discard block |
||
| 1651 | 1651 | if (empty($obj->country_code)) { |
| 1652 | 1652 | $valuetoshow = '-'; |
| 1653 | 1653 | } else { |
| 1654 | - $key = $langs->trans("Country" . strtoupper($obj->country_code)); |
|
| 1655 | - $valuetoshow = ($key != "Country" . strtoupper($obj->country_code) ? $obj->country_code . " - " . $key : $obj->country); |
|
| 1654 | + $key = $langs->trans("Country".strtoupper($obj->country_code)); |
|
| 1655 | + $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); |
|
| 1656 | 1656 | } |
| 1657 | 1657 | } else if ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { |
| 1658 | 1658 | $valuetoshow = yn($valuetoshow); |
@@ -1673,58 +1673,58 @@ discard block |
||
| 1673 | 1673 | $valuetoshow = yn($elementList[$valuetoshow]); |
| 1674 | 1674 | } else if ($fieldlist[$field] == 'libelle_facture') { |
| 1675 | 1675 | $langs->load("bills"); |
| 1676 | - $key = $langs->trans("PaymentCondition" . strtoupper($obj->code)); |
|
| 1677 | - $valuetoshow = ($obj->code && $key != "PaymentCondition" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1676 | + $key = $langs->trans("PaymentCondition".strtoupper($obj->code)); |
|
| 1677 | + $valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1678 | 1678 | $valuetoshow = nl2br($valuetoshow); |
| 1679 | - } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_country') { |
|
| 1680 | - $key = $langs->trans("Country" . strtoupper($obj->code)); |
|
| 1681 | - $valuetoshow = ($obj->code && $key != "Country" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1682 | - } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_availability') { |
|
| 1679 | + } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') { |
|
| 1680 | + $key = $langs->trans("Country".strtoupper($obj->code)); |
|
| 1681 | + $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1682 | + } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') { |
|
| 1683 | 1683 | $langs->load("propal"); |
| 1684 | - $key = $langs->trans("AvailabilityType" . strtoupper($obj->code)); |
|
| 1685 | - $valuetoshow = ($obj->code && $key != "AvailabilityType" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1686 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_actioncomm') { |
|
| 1687 | - $key = $langs->trans("Action" . strtoupper($obj->code)); |
|
| 1688 | - $valuetoshow = ($obj->code && $key != "Action" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1689 | - } else if (!empty($obj->code_iso) && $fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_currencies') { |
|
| 1690 | - $key = $langs->trans("Currency" . strtoupper($obj->code_iso)); |
|
| 1691 | - $valuetoshow = ($obj->code_iso && $key != "Currency" . strtoupper($obj->code_iso) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1692 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_typent') { |
|
| 1684 | + $key = $langs->trans("AvailabilityType".strtoupper($obj->code)); |
|
| 1685 | + $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1686 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') { |
|
| 1687 | + $key = $langs->trans("Action".strtoupper($obj->code)); |
|
| 1688 | + $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1689 | + } else if (!empty($obj->code_iso) && $fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_currencies') { |
|
| 1690 | + $key = $langs->trans("Currency".strtoupper($obj->code_iso)); |
|
| 1691 | + $valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1692 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_typent') { |
|
| 1693 | 1693 | $key = $langs->trans(strtoupper($obj->code)); |
| 1694 | 1694 | $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
| 1695 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_prospectlevel') { |
|
| 1695 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_prospectlevel') { |
|
| 1696 | 1696 | $key = $langs->trans(strtoupper($obj->code)); |
| 1697 | 1697 | $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
| 1698 | - } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_civility') { |
|
| 1699 | - $key = $langs->trans("Civility" . strtoupper($obj->code)); |
|
| 1700 | - $valuetoshow = ($obj->code && $key != "Civility" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1701 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_type_contact') { |
|
| 1698 | + } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_civility') { |
|
| 1699 | + $key = $langs->trans("Civility".strtoupper($obj->code)); |
|
| 1700 | + $valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1701 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_contact') { |
|
| 1702 | 1702 | $langs->load('agenda'); |
| 1703 | - $key = $langs->trans("TypeContact_" . $obj->element . "_" . $obj->source . "_" . strtoupper($obj->code)); |
|
| 1704 | - $valuetoshow = ($obj->code && $key != "TypeContact_" . $obj->element . "_" . $obj->source . "_" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1705 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_payment_term') { |
|
| 1703 | + $key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); |
|
| 1704 | + $valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1705 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_payment_term') { |
|
| 1706 | 1706 | $langs->load("bills"); |
| 1707 | - $key = $langs->trans("PaymentConditionShort" . strtoupper($obj->code)); |
|
| 1708 | - $valuetoshow = ($obj->code && $key != "PaymentConditionShort" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1709 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_paiement') { |
|
| 1707 | + $key = $langs->trans("PaymentConditionShort".strtoupper($obj->code)); |
|
| 1708 | + $valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1709 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') { |
|
| 1710 | 1710 | $langs->load("bills"); |
| 1711 | - $key = $langs->trans("PaymentType" . strtoupper($obj->code)); |
|
| 1712 | - $valuetoshow = ($obj->code && $key != "PaymentType" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1713 | - } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_input_reason') { |
|
| 1714 | - $key = $langs->trans("DemandReasonType" . strtoupper($obj->code)); |
|
| 1715 | - $valuetoshow = ($obj->code && $key != "DemandReasonType" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1716 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_input_method') { |
|
| 1711 | + $key = $langs->trans("PaymentType".strtoupper($obj->code)); |
|
| 1712 | + $valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1713 | + } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_reason') { |
|
| 1714 | + $key = $langs->trans("DemandReasonType".strtoupper($obj->code)); |
|
| 1715 | + $valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1716 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_method') { |
|
| 1717 | 1717 | $langs->load("orders"); |
| 1718 | 1718 | $key = $langs->trans($obj->code); |
| 1719 | 1719 | $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$fieldlist[$field]}; |
| 1720 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_shipment_mode') { |
|
| 1720 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_shipment_mode') { |
|
| 1721 | 1721 | $langs->load("sendings"); |
| 1722 | - $key = $langs->trans("SendingMethod" . strtoupper($obj->code)); |
|
| 1723 | - $valuetoshow = ($obj->code && $key != "SendingMethod" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1724 | - } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_paper_format') { |
|
| 1725 | - $key = $langs->trans('PaperFormat' . strtoupper($obj->code)); |
|
| 1726 | - $valuetoshow = ($obj->code && $key != 'PaperFormat' . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1727 | - } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_type_fees') { |
|
| 1722 | + $key = $langs->trans("SendingMethod".strtoupper($obj->code)); |
|
| 1723 | + $valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1724 | + } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paper_format') { |
|
| 1725 | + $key = $langs->trans('PaperFormat'.strtoupper($obj->code)); |
|
| 1726 | + $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1727 | + } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') { |
|
| 1728 | 1728 | $langs->load('trips'); |
| 1729 | 1729 | $key = $langs->trans(strtoupper($obj->code)); |
| 1730 | 1730 | $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); |
@@ -1732,15 +1732,15 @@ discard block |
||
| 1732 | 1732 | $showfield = 0; |
| 1733 | 1733 | } else if ($fieldlist[$field] == 'unicode') { |
| 1734 | 1734 | $valuetoshow = $langs->getCurrencySymbol($obj->code, 1); |
| 1735 | - } else if ($fieldlist[$field] == 'label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX . 'c_units') { |
|
| 1735 | + } else if ($fieldlist[$field] == 'label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') { |
|
| 1736 | 1736 | $langs->load("products"); |
| 1737 | 1737 | $valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); |
| 1738 | - } else if ($fieldlist[$field] == 'short_label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX . 'c_units') { |
|
| 1738 | + } else if ($fieldlist[$field] == 'short_label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') { |
|
| 1739 | 1739 | $langs->load("products"); |
| 1740 | 1740 | $valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); |
| 1741 | - } else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX . 'c_paper_format')) { |
|
| 1742 | - $key = $langs->trans('SizeUnit' . strtolower($obj->unit)); |
|
| 1743 | - $valuetoshow = ($obj->code && $key != 'SizeUnit' . strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1741 | + } else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) { |
|
| 1742 | + $key = $langs->trans('SizeUnit'.strtolower($obj->unit)); |
|
| 1743 | + $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); |
|
| 1744 | 1744 | } else if ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') { |
| 1745 | 1745 | $align = "center"; |
| 1746 | 1746 | } else if ($fieldlist[$field] == 'localtax1_type') { |
@@ -1772,9 +1772,9 @@ discard block |
||
| 1772 | 1772 | } |
| 1773 | 1773 | } |
| 1774 | 1774 | } elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat') { |
| 1775 | - $valuetoshow = getDictvalue(MAIN_DB_PREFIX . 'c_exp_tax_cat', 'label', $valuetoshow); |
|
| 1775 | + $valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow); |
|
| 1776 | 1776 | $valuetoshow = $langs->trans($valuetoshow); |
| 1777 | - } elseif ($tabname[$id] == MAIN_DB_PREFIX . 'c_exp_tax_cat') { |
|
| 1777 | + } elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat') { |
|
| 1778 | 1778 | $valuetoshow = $langs->trans($valuetoshow); |
| 1779 | 1779 | } |
| 1780 | 1780 | |
@@ -1793,7 +1793,7 @@ discard block |
||
| 1793 | 1793 | $class .= ' nowrap'; |
| 1794 | 1794 | // Show value for field |
| 1795 | 1795 | if ($showfield) |
| 1796 | - print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>'; |
|
| 1796 | + print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; |
|
| 1797 | 1797 | } |
| 1798 | 1798 | } |
| 1799 | 1799 | |
@@ -1824,7 +1824,7 @@ discard block |
||
| 1824 | 1824 | $canbemodified = $iserasable; |
| 1825 | 1825 | if ($obj->code == 'RECEP') |
| 1826 | 1826 | $canbemodified = 1; |
| 1827 | - if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm") |
|
| 1827 | + if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm") |
|
| 1828 | 1828 | $canbemodified = 1; |
| 1829 | 1829 | |
| 1830 | 1830 | // Url |
@@ -1833,11 +1833,11 @@ discard block |
||
| 1833 | 1833 | if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27))) |
| 1834 | 1834 | $rowidcol = 'rowid'; |
| 1835 | 1835 | //$url = $_SERVER["PHP_SELF"] . '?' . ($page ? 'page=' . $page . '&' : '') . 'sortfield=' . $sortfield . '&sortorder=' . $sortorder . '&rowid=' . ((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')) . '&code=' . (!empty($obj->code) ? urlencode($obj->code) : ''); |
| 1836 | - $url = BASE_URI . '?controller=admin&method=dict&' . ($page ? 'page=' . $page . '&' : '') . 'sortfield=' . $sortfield . '&sortorder=' . $sortorder . '&rowid=' . ((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')) . '&code=' . (!empty($obj->code) ? urlencode($obj->code) : ''); |
|
| 1836 | + $url = BASE_URI.'?controller=admin&method=dict&'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : ''); |
|
| 1837 | 1837 | if (!empty($param)) |
| 1838 | - $url .= '&' . $param; |
|
| 1838 | + $url .= '&'.$param; |
|
| 1839 | 1839 | if (!is_null($withentity)) |
| 1840 | - $url .= '&entity=' . $withentity; |
|
| 1840 | + $url .= '&entity='.$withentity; |
|
| 1841 | 1841 | $url .= '&'; |
| 1842 | 1842 | |
| 1843 | 1843 | // Favorite |
@@ -1845,7 +1845,7 @@ discard block |
||
| 1845 | 1845 | if ($id == 4) { |
| 1846 | 1846 | print '<td align="center" class="nowrap">'; |
| 1847 | 1847 | if ($iserasable) |
| 1848 | - print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>'; |
|
| 1848 | + print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>'; |
|
| 1849 | 1849 | else |
| 1850 | 1850 | print $langs->trans("AlwaysActive"); |
| 1851 | 1851 | print '</td>'; |
@@ -1854,7 +1854,7 @@ discard block |
||
| 1854 | 1854 | // Active |
| 1855 | 1855 | print '<td align="center" class="nowrap">'; |
| 1856 | 1856 | if ($canbedisabled) |
| 1857 | - print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>'; |
|
| 1857 | + print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; |
|
| 1858 | 1858 | else { |
| 1859 | 1859 | if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO'))) |
| 1860 | 1860 | print $langs->trans("AlwaysActive"); |
@@ -1869,7 +1869,7 @@ discard block |
||
| 1869 | 1869 | |
| 1870 | 1870 | // Modify link |
| 1871 | 1871 | if ($canbemodified) |
| 1872 | - print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>'; |
|
| 1872 | + print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; |
|
| 1873 | 1873 | else |
| 1874 | 1874 | print '<td> </td>'; |
| 1875 | 1875 | |
@@ -1877,7 +1877,7 @@ discard block |
||
| 1877 | 1877 | if ($iserasable) { |
| 1878 | 1878 | print '<td align="center">'; |
| 1879 | 1879 | if ($user->admin) |
| 1880 | - print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>'; |
|
| 1880 | + print '<a href="'.$url.'action=delete">'.img_delete().'</a>'; |
|
| 1881 | 1881 | //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin |
| 1882 | 1882 | print '</td>'; |
| 1883 | 1883 | } else |
@@ -1909,8 +1909,8 @@ discard block |
||
| 1909 | 1909 | print '<table class="noborder" width="100%">'; |
| 1910 | 1910 | print '<tr class="liste_titre">'; |
| 1911 | 1911 | //print '<td>'.$langs->trans("Module").'</td>'; |
| 1912 | - print '<td colspan="2">' . $langs->trans("Dictionary") . '</td>'; |
|
| 1913 | - print '<td>' . $langs->trans("Table") . '</td>'; |
|
| 1912 | + print '<td colspan="2">'.$langs->trans("Dictionary").'</td>'; |
|
| 1913 | + print '<td>'.$langs->trans("Table").'</td>'; |
|
| 1914 | 1914 | print '</tr>'; |
| 1915 | 1915 | |
| 1916 | 1916 | $showemptyline = ''; |
@@ -1930,7 +1930,7 @@ discard block |
||
| 1930 | 1930 | print '<tr class="oddeven"><td width="50%">'; |
| 1931 | 1931 | if (!empty($tabcond[$i])) { |
| 1932 | 1932 | // print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $i . '">' . $langs->trans($tablib[$i]) . '</a>'; |
| 1933 | - print '<a href="' . BASE_URI . '?controller=admin&method=dict&id=' . $i . '">' . $langs->trans($tablib[$i]) . '</a>'; |
|
| 1933 | + print '<a href="'.BASE_URI.'?controller=admin&method=dict&id='.$i.'">'.$langs->trans($tablib[$i]).'</a>'; |
|
| 1934 | 1934 | } else { |
| 1935 | 1935 | print $langs->trans($tablib[$i]); |
| 1936 | 1936 | } |
@@ -1941,7 +1941,7 @@ discard block |
||
| 1941 | 1941 | print info_admin($langs->trans("DictionaryDisabledSinceNoModuleNeedIt"),1); |
| 1942 | 1942 | } */ |
| 1943 | 1943 | print '</td>'; |
| 1944 | - print '<td>' . $tabname[$i] . '</td></tr>'; |
|
| 1944 | + print '<td>'.$tabname[$i].'</td></tr>'; |
|
| 1945 | 1945 | $lastlineisempty = false; |
| 1946 | 1946 | } else { |
| 1947 | 1947 | if (!$lastlineisempty) { |
@@ -1990,10 +1990,10 @@ discard block |
||
| 1990 | 1990 | continue; |
| 1991 | 1991 | } |
| 1992 | 1992 | |
| 1993 | - if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX . "c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) { |
|
| 1993 | + if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) { |
|
| 1994 | 1994 | $hidden = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''); |
| 1995 | 1995 | print '<td>'; |
| 1996 | - print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $hidden . '">'; |
|
| 1996 | + print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$hidden.'">'; |
|
| 1997 | 1997 | print $langs->trans($hidden); |
| 1998 | 1998 | print '</td>'; |
| 1999 | 1999 | } elseif ($fieldlist[$field] == 'country') { |
@@ -2011,7 +2011,7 @@ discard block |
||
| 2011 | 2011 | if (!in_array('country', $fieldlist)) { // If there is already a field country, we don't show country_id (avoid duplicate) |
| 2012 | 2012 | $country_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0); |
| 2013 | 2013 | print '<td class="tdoverflowmax100">'; |
| 2014 | - print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $country_id . '">'; |
|
| 2014 | + print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">'; |
|
| 2015 | 2015 | print '</td>'; |
| 2016 | 2016 | } |
| 2017 | 2017 | } elseif ($fieldlist[$field] == 'region') { |
@@ -2021,7 +2021,7 @@ discard block |
||
| 2021 | 2021 | } elseif ($fieldlist[$field] == 'region_id') { |
| 2022 | 2022 | $region_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0); |
| 2023 | 2023 | print '<td>'; |
| 2024 | - print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $region_id . '">'; |
|
| 2024 | + print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">'; |
|
| 2025 | 2025 | print '</td>'; |
| 2026 | 2026 | } elseif ($fieldlist[$field] == 'lang') { |
| 2027 | 2027 | print '<td>'; |
@@ -2043,10 +2043,10 @@ discard block |
||
| 2043 | 2043 | print '<td>'; |
| 2044 | 2044 | print $form->selectyesno("private", (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')); |
| 2045 | 2045 | print '</td>'; |
| 2046 | - } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX . "c_actioncomm") { |
|
| 2046 | + } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") { |
|
| 2047 | 2047 | $type = (!empty($obj->type) ? $obj->type : 'user'); // Check if type is different of 'user' (external module) |
| 2048 | 2048 | print '<td>'; |
| 2049 | - print $type . '<input type="hidden" name="type" value="' . $type . '">'; |
|
| 2049 | + print $type.'<input type="hidden" name="type" value="'.$type.'">'; |
|
| 2050 | 2050 | print '</td>'; |
| 2051 | 2051 | } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { |
| 2052 | 2052 | if ($fieldlist[$field] == 'type_cdr') |
@@ -2063,30 +2063,30 @@ discard block |
||
| 2063 | 2063 | $align = "left"; |
| 2064 | 2064 | if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) |
| 2065 | 2065 | $align = "center"; // Fields aligned on right |
| 2066 | - print '<td align="' . $align . '">'; |
|
| 2067 | - print '<input type="text" class="flat" value="' . (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" size="3" name="' . $fieldlist[$field] . '">'; |
|
| 2066 | + print '<td align="'.$align.'">'; |
|
| 2067 | + print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">'; |
|
| 2068 | 2068 | print '</td>'; |
| 2069 | 2069 | } |
| 2070 | 2070 | elseif (in_array($fieldlist[$field], array('libelle_facture'))) { |
| 2071 | 2071 | print '<td>'; |
| 2072 | 2072 | $transfound = 0; |
| 2073 | 2073 | // Special case for labels |
| 2074 | - if ($tabname == MAIN_DB_PREFIX . 'c_payment_term') { |
|
| 2074 | + if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { |
|
| 2075 | 2075 | $langs->load("bills"); |
| 2076 | - $transkey = "PaymentCondition" . strtoupper($obj->code); |
|
| 2076 | + $transkey = "PaymentCondition".strtoupper($obj->code); |
|
| 2077 | 2077 | if ($langs->trans($transkey) != $transkey) { |
| 2078 | 2078 | $transfound = 1; |
| 2079 | 2079 | print $form->textwithpicto($langs->trans($transkey), $langs->trans("GoIntoTranslationMenuToChangeThis")); |
| 2080 | 2080 | } |
| 2081 | 2081 | } |
| 2082 | 2082 | if (!$transfound) { |
| 2083 | - print '<textarea cols="30" rows="' . ROWS_2 . '" class="flat" name="' . $fieldlist[$field] . '">' . (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '</textarea>'; |
|
| 2083 | + print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'</textarea>'; |
|
| 2084 | 2084 | } |
| 2085 | 2085 | print '</td>'; |
| 2086 | 2086 | } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) { |
| 2087 | - print '<td><input type="text" class="flat minwidth75" value="' . price((!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')) . '" name="' . $fieldlist[$field] . '"></td>'; |
|
| 2087 | + print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')).'" name="'.$fieldlist[$field].'"></td>'; |
|
| 2088 | 2088 | } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { |
| 2089 | - print '<td class="maxxxx"><input type="text" class="flat minwidth75" value="' . (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" name="' . $fieldlist[$field] . '"></td>'; |
|
| 2089 | + print '<td class="maxxxx"><input type="text" class="flat minwidth75" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'"></td>'; |
|
| 2090 | 2090 | } elseif ($fieldlist[$field] == 'unit') { |
| 2091 | 2091 | print '<td>'; |
| 2092 | 2092 | $units = array( |
@@ -2108,10 +2108,10 @@ discard block |
||
| 2108 | 2108 | if (!empty($conf->accounting->enabled)) { |
| 2109 | 2109 | $fieldname = $fieldlist[$field]; |
| 2110 | 2110 | $accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0); |
| 2111 | - print $formaccounting->select_account($accountancy_account, '.' . $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); |
|
| 2111 | + print $formaccounting->select_account($accountancy_account, '.'.$fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); |
|
| 2112 | 2112 | } else { |
| 2113 | 2113 | $fieldname = $fieldlist[$field]; |
| 2114 | - print '<input type="text" size="10" class="flat" value="' . (isset($obj->$fieldname) ? $obj->$fieldname : '') . '" name="' . $fieldlist[$field] . '">'; |
|
| 2114 | + print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname : '').'" name="'.$fieldlist[$field].'">'; |
|
| 2115 | 2115 | } |
| 2116 | 2116 | print '</td>'; |
| 2117 | 2117 | } elseif ($fieldlist[$field] == 'fk_tva') { |
@@ -2146,17 +2146,17 @@ discard block |
||
| 2146 | 2146 | $class = 'quatrevingtpercent'; |
| 2147 | 2147 | if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') |
| 2148 | 2148 | $class = 'maxwidth50'; |
| 2149 | - print '<td class="' . $classtd . '">'; |
|
| 2149 | + print '<td class="'.$classtd.'">'; |
|
| 2150 | 2150 | $transfound = 0; |
| 2151 | 2151 | if (in_array($fieldlist[$field], array('label', 'libelle'))) { |
| 2152 | 2152 | $transkey = ''; |
| 2153 | 2153 | // Special case for labels |
| 2154 | - if ($tabname == MAIN_DB_PREFIX . 'c_civility') { |
|
| 2155 | - $transkey = "Civility" . strtoupper($obj->code); |
|
| 2154 | + if ($tabname == MAIN_DB_PREFIX.'c_civility') { |
|
| 2155 | + $transkey = "Civility".strtoupper($obj->code); |
|
| 2156 | 2156 | } |
| 2157 | - if ($tabname == MAIN_DB_PREFIX . 'c_payment_term') { |
|
| 2157 | + if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { |
|
| 2158 | 2158 | $langs->load("bills"); |
| 2159 | - $transkey = "PaymentCondition" . strtoupper($obj->code); |
|
| 2159 | + $transkey = "PaymentCondition".strtoupper($obj->code); |
|
| 2160 | 2160 | } |
| 2161 | 2161 | if ($transkey && $langs->trans($transkey) != $transkey) { |
| 2162 | 2162 | $transfound = 1; |
@@ -2164,7 +2164,7 @@ discard block |
||
| 2164 | 2164 | } |
| 2165 | 2165 | } |
| 2166 | 2166 | if (!$transfound) { |
| 2167 | - print '<input type="text" class="flat' . ($class ? ' ' . $class : '') . '" value="' . (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" name="' . $fieldlist[$field] . '">'; |
|
| 2167 | + print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">'; |
|
| 2168 | 2168 | } |
| 2169 | 2169 | print '</td>'; |
| 2170 | 2170 | } |
@@ -568,8 +568,9 @@ discard block |
||
| 568 | 568 | 'fichinter' => $langs->trans('InterventionCard'), |
| 569 | 569 | 'contrat' => $langs->trans('Contract') |
| 570 | 570 | ); |
| 571 | - if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) |
|
| 572 | - $elementList["societe"] = $langs->trans('ThirdParty'); |
|
| 571 | + if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) { |
|
| 572 | + $elementList["societe"] = $langs->trans('ThirdParty'); |
|
| 573 | + } |
|
| 573 | 574 | |
| 574 | 575 | complete_elementList_with_modules($elementList); |
| 575 | 576 | |
@@ -615,20 +616,30 @@ discard block |
||
| 615 | 616 | // Check that all fields are filled |
| 616 | 617 | $ok = 1; |
| 617 | 618 | foreach ($listfield as $f => $value) { |
| 618 | - if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) |
|
| 619 | - continue; // For some pages, country is not mandatory |
|
| 620 | - if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) |
|
| 621 | - continue; // For some pages, country is not mandatory |
|
| 622 | - if ($value == 'localtax1' && empty($_POST['localtax1_type'])) |
|
| 623 | - continue; |
|
| 624 | - if ($value == 'localtax2' && empty($_POST['localtax2_type'])) |
|
| 625 | - continue; |
|
| 626 | - if ($value == 'color' && empty($_POST['color'])) |
|
| 627 | - continue; |
|
| 628 | - if ($value == 'formula' && empty($_POST['formula'])) |
|
| 629 | - continue; |
|
| 630 | - if ($value == 'sortorder') |
|
| 631 | - continue; // For a column name 'sortorder', we use the field name 'position' |
|
| 619 | + if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { |
|
| 620 | + continue; |
|
| 621 | + } |
|
| 622 | + // For some pages, country is not mandatory |
|
| 623 | + if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) { |
|
| 624 | + continue; |
|
| 625 | + } |
|
| 626 | + // For some pages, country is not mandatory |
|
| 627 | + if ($value == 'localtax1' && empty($_POST['localtax1_type'])) { |
|
| 628 | + continue; |
|
| 629 | + } |
|
| 630 | + if ($value == 'localtax2' && empty($_POST['localtax2_type'])) { |
|
| 631 | + continue; |
|
| 632 | + } |
|
| 633 | + if ($value == 'color' && empty($_POST['color'])) { |
|
| 634 | + continue; |
|
| 635 | + } |
|
| 636 | + if ($value == 'formula' && empty($_POST['formula'])) { |
|
| 637 | + continue; |
|
| 638 | + } |
|
| 639 | + if ($value == 'sortorder') { |
|
| 640 | + continue; |
|
| 641 | + } |
|
| 642 | + // For a column name 'sortorder', we use the field name 'position' |
|
| 632 | 643 | if ((!isset($_POST[$value]) || $_POST[$value] == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking')) // Fields that are not mandatory |
| 633 | 644 | && (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 |
| 634 | 645 | ) |
@@ -636,36 +647,51 @@ discard block |
||
| 636 | 647 | $ok = 0; |
| 637 | 648 | $fieldnamekey = $listfield[$f]; |
| 638 | 649 | // We take translate key of field |
| 639 | - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) |
|
| 640 | - $fieldnamekey = 'Label'; |
|
| 641 | - if ($fieldnamekey == 'libelle_facture') |
|
| 642 | - $fieldnamekey = 'LabelOnDocuments'; |
|
| 643 | - if ($fieldnamekey == 'nbjour') |
|
| 644 | - $fieldnamekey = 'NbOfDays'; |
|
| 645 | - if ($fieldnamekey == 'decalage') |
|
| 646 | - $fieldnamekey = 'Offset'; |
|
| 647 | - if ($fieldnamekey == 'module') |
|
| 648 | - $fieldnamekey = 'Module'; |
|
| 649 | - if ($fieldnamekey == 'code') |
|
| 650 | - $fieldnamekey = 'Code'; |
|
| 651 | - if ($fieldnamekey == 'note') |
|
| 652 | - $fieldnamekey = 'Note'; |
|
| 653 | - if ($fieldnamekey == 'taux') |
|
| 654 | - $fieldnamekey = 'Rate'; |
|
| 655 | - if ($fieldnamekey == 'type') |
|
| 656 | - $fieldnamekey = 'Type'; |
|
| 657 | - if ($fieldnamekey == 'position') |
|
| 658 | - $fieldnamekey = 'Position'; |
|
| 659 | - if ($fieldnamekey == 'unicode') |
|
| 660 | - $fieldnamekey = 'Unicode'; |
|
| 661 | - if ($fieldnamekey == 'deductible') |
|
| 662 | - $fieldnamekey = 'Deductible'; |
|
| 663 | - if ($fieldnamekey == 'sortorder') |
|
| 664 | - $fieldnamekey = 'SortOrder'; |
|
| 665 | - if ($fieldnamekey == 'category_type') |
|
| 666 | - $fieldnamekey = 'Calculated'; |
|
| 667 | - if ($fieldnamekey == 'revenuestamp_type') |
|
| 668 | - $fieldnamekey = 'TypeOfRevenueStamp'; |
|
| 650 | + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { |
|
| 651 | + $fieldnamekey = 'Label'; |
|
| 652 | + } |
|
| 653 | + if ($fieldnamekey == 'libelle_facture') { |
|
| 654 | + $fieldnamekey = 'LabelOnDocuments'; |
|
| 655 | + } |
|
| 656 | + if ($fieldnamekey == 'nbjour') { |
|
| 657 | + $fieldnamekey = 'NbOfDays'; |
|
| 658 | + } |
|
| 659 | + if ($fieldnamekey == 'decalage') { |
|
| 660 | + $fieldnamekey = 'Offset'; |
|
| 661 | + } |
|
| 662 | + if ($fieldnamekey == 'module') { |
|
| 663 | + $fieldnamekey = 'Module'; |
|
| 664 | + } |
|
| 665 | + if ($fieldnamekey == 'code') { |
|
| 666 | + $fieldnamekey = 'Code'; |
|
| 667 | + } |
|
| 668 | + if ($fieldnamekey == 'note') { |
|
| 669 | + $fieldnamekey = 'Note'; |
|
| 670 | + } |
|
| 671 | + if ($fieldnamekey == 'taux') { |
|
| 672 | + $fieldnamekey = 'Rate'; |
|
| 673 | + } |
|
| 674 | + if ($fieldnamekey == 'type') { |
|
| 675 | + $fieldnamekey = 'Type'; |
|
| 676 | + } |
|
| 677 | + if ($fieldnamekey == 'position') { |
|
| 678 | + $fieldnamekey = 'Position'; |
|
| 679 | + } |
|
| 680 | + if ($fieldnamekey == 'unicode') { |
|
| 681 | + $fieldnamekey = 'Unicode'; |
|
| 682 | + } |
|
| 683 | + if ($fieldnamekey == 'deductible') { |
|
| 684 | + $fieldnamekey = 'Deductible'; |
|
| 685 | + } |
|
| 686 | + if ($fieldnamekey == 'sortorder') { |
|
| 687 | + $fieldnamekey = 'SortOrder'; |
|
| 688 | + } |
|
| 689 | + if ($fieldnamekey == 'category_type') { |
|
| 690 | + $fieldnamekey = 'Calculated'; |
|
| 691 | + } |
|
| 692 | + if ($fieldnamekey == 'revenuestamp_type') { |
|
| 693 | + $fieldnamekey = 'TypeOfRevenueStamp'; |
|
| 694 | + } |
|
| 669 | 695 | |
| 670 | 696 | setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); |
| 671 | 697 | } |
@@ -700,16 +726,26 @@ discard block |
||
| 700 | 726 | } |
| 701 | 727 | |
| 702 | 728 | // Clean some parameters |
| 703 | - if ((!empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"])) |
|
| 704 | - $_POST["localtax1"] = '0'; // If empty, we force to 0 |
|
| 705 | - if ((!empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"])) |
|
| 706 | - $_POST["localtax2"] = '0'; // If empty, we force to 0 |
|
| 707 | - if ($_POST["accountancy_code"] <= 0) |
|
| 708 | - $_POST["accountancy_code"] = ''; // If empty, we force to null |
|
| 709 | - if ($_POST["accountancy_code_sell"] <= 0) |
|
| 710 | - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null |
|
| 711 | - if ($_POST["accountancy_code_buy"] <= 0) |
|
| 712 | - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null |
|
| 729 | + if ((!empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"])) { |
|
| 730 | + $_POST["localtax1"] = '0'; |
|
| 731 | + } |
|
| 732 | + // If empty, we force to 0 |
|
| 733 | + if ((!empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"])) { |
|
| 734 | + $_POST["localtax2"] = '0'; |
|
| 735 | + } |
|
| 736 | + // If empty, we force to 0 |
|
| 737 | + if ($_POST["accountancy_code"] <= 0) { |
|
| 738 | + $_POST["accountancy_code"] = ''; |
|
| 739 | + } |
|
| 740 | + // If empty, we force to null |
|
| 741 | + if ($_POST["accountancy_code_sell"] <= 0) { |
|
| 742 | + $_POST["accountancy_code_sell"] = ''; |
|
| 743 | + } |
|
| 744 | + // If empty, we force to null |
|
| 745 | + if ($_POST["accountancy_code_buy"] <= 0) { |
|
| 746 | + $_POST["accountancy_code_buy"] = ''; |
|
| 747 | + } |
|
| 748 | + // If empty, we force to null |
|
| 713 | 749 | if ($id == 10 && isset($_POST["code"])) { // Spaces are not allowed into code |
| 714 | 750 | $_POST["code"] = preg_replace('/\s/', '', $_POST["code"]); |
| 715 | 751 | } |
@@ -732,15 +768,17 @@ discard block |
||
| 732 | 768 | // Add new entry |
| 733 | 769 | $sql = "INSERT INTO " . $tabname[$id] . " ("; |
| 734 | 770 | // List of fields |
| 735 | - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) |
|
| 736 | - $sql .= $tabrowid[$id] . ","; |
|
| 771 | + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { |
|
| 772 | + $sql .= $tabrowid[$id] . ","; |
|
| 773 | + } |
|
| 737 | 774 | $sql .= $tabfieldinsert[$id]; |
| 738 | 775 | $sql .= ",active)"; |
| 739 | 776 | $sql .= " VALUES("; |
| 740 | 777 | |
| 741 | 778 | // List of values |
| 742 | - if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) |
|
| 743 | - $sql .= $newid . ","; |
|
| 779 | + if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) { |
|
| 780 | + $sql .= $newid . ","; |
|
| 781 | + } |
|
| 744 | 782 | $i = 0; |
| 745 | 783 | foreach ($listfieldinsert as $f => $value) { |
| 746 | 784 | if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') { |
@@ -748,14 +786,18 @@ discard block |
||
| 748 | 786 | } else if ($value == 'entity') { |
| 749 | 787 | $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]); |
| 750 | 788 | } |
| 751 | - if ($i) |
|
| 752 | - $sql .= ","; |
|
| 789 | + if ($i) { |
|
| 790 | + $sql .= ","; |
|
| 791 | + } |
|
| 753 | 792 | if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' |
| 754 | 793 | $sql .= "'" . (int) $db->escape($_POST['position']) . "'"; |
| 755 | - } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) |
|
| 756 | - $sql .= "null"; // For vat, we want/accept code = '' |
|
| 757 | - else |
|
| 758 | - $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'"; |
|
| 794 | + } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) { |
|
| 795 | + $sql .= "null"; |
|
| 796 | + } |
|
| 797 | + // For vat, we want/accept code = '' |
|
| 798 | + else { |
|
| 799 | + $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'"; |
|
| 800 | + } |
|
| 759 | 801 | $i++; |
| 760 | 802 | } |
| 761 | 803 | $sql .= ",1)"; |
@@ -796,20 +838,25 @@ discard block |
||
| 796 | 838 | } else if ($field == 'entity') { |
| 797 | 839 | $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]); |
| 798 | 840 | } |
| 799 | - if ($i) |
|
| 800 | - $sql .= ","; |
|
| 841 | + if ($i) { |
|
| 842 | + $sql .= ","; |
|
| 843 | + } |
|
| 801 | 844 | $sql .= $field . "="; |
| 802 | 845 | if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' |
| 803 | 846 | $sql .= "'" . (int) $db->escape($_POST['position']) . "'"; |
| 804 | - } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) |
|
| 805 | - $sql .= "null"; // For vat, we want/accept code = '' |
|
| 806 | - else |
|
| 807 | - $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'"; |
|
| 847 | + } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) { |
|
| 848 | + $sql .= "null"; |
|
| 849 | + } |
|
| 850 | + // For vat, we want/accept code = '' |
|
| 851 | + else { |
|
| 852 | + $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'"; |
|
| 853 | + } |
|
| 808 | 854 | $i++; |
| 809 | 855 | } |
| 810 | 856 | $sql .= " WHERE " . $rowidcol . " = '" . $rowid . "'"; |
| 811 | - if (in_array('entity', $listfieldmodify)) |
|
| 812 | - $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'"; |
|
| 857 | + if (in_array('entity', $listfieldmodify)) { |
|
| 858 | + $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'"; |
|
| 859 | + } |
|
| 813 | 860 | |
| 814 | 861 | dol_syslog("actionmodify", LOG_DEBUG); |
| 815 | 862 | //print $sql; |
@@ -962,19 +1009,25 @@ discard block |
||
| 962 | 1009 | |
| 963 | 1010 | |
| 964 | 1011 | $param = '&id=' . urlencode($id); |
| 965 | -if ($search_country_id > 0) |
|
| 1012 | +if ($search_country_id > 0) { |
|
| 966 | 1013 | $param .= '&search_country_id=' . urlencode($search_country_id); |
| 967 | -if ($search_code != '') |
|
| 1014 | +} |
|
| 1015 | +if ($search_code != '') { |
|
| 968 | 1016 | $param .= '&search_code=' . urlencode($search_country_id); |
| 969 | -if ($entity != '') |
|
| 1017 | +} |
|
| 1018 | +if ($entity != '') { |
|
| 970 | 1019 | $param .= '&entity=' . (int) $entity; |
| 1020 | +} |
|
| 971 | 1021 | $paramwithsearch = $param; |
| 972 | -if ($sortorder) |
|
| 1022 | +if ($sortorder) { |
|
| 973 | 1023 | $paramwithsearch .= '&sortorder=' . urlencode($sortorder); |
| 974 | -if ($sortfield) |
|
| 1024 | +} |
|
| 1025 | +if ($sortfield) { |
|
| 975 | 1026 | $paramwithsearch .= '&sortfield=' . urlencode($sortfield); |
| 976 | -if (GETPOST('from')) |
|
| 1027 | +} |
|
| 1028 | +if (GETPOST('from')) { |
|
| 977 | 1029 | $paramwithsearch .= '&from=' . urlencode(GETPOST('from', 'alpha')); |
| 1030 | +} |
|
| 978 | 1031 | |
| 979 | 1032 | |
| 980 | 1033 | // Confirmation de la suppression de la ligne |
@@ -990,19 +1043,24 @@ discard block |
||
| 990 | 1043 | // Complete requete recherche valeurs avec critere de tri |
| 991 | 1044 | $sql = $tabsql[$id]; |
| 992 | 1045 | |
| 993 | - if (!preg_match('/ WHERE /', $sql)) |
|
| 994 | - $sql .= " WHERE 1 = 1"; |
|
| 995 | - if ($search_country_id > 0) |
|
| 996 | - $sql .= " AND c.rowid = " . $search_country_id; |
|
| 997 | - if ($search_code != '' && $id != 9) |
|
| 998 | - $sql .= natural_search("code", $search_code); |
|
| 999 | - if ($search_code != '' && $id == 9) |
|
| 1000 | - $sql .= natural_search("code_iso", $search_code); |
|
| 1046 | + if (!preg_match('/ WHERE /', $sql)) { |
|
| 1047 | + $sql .= " WHERE 1 = 1"; |
|
| 1048 | + } |
|
| 1049 | + if ($search_country_id > 0) { |
|
| 1050 | + $sql .= " AND c.rowid = " . $search_country_id; |
|
| 1051 | + } |
|
| 1052 | + if ($search_code != '' && $id != 9) { |
|
| 1053 | + $sql .= natural_search("code", $search_code); |
|
| 1054 | + } |
|
| 1055 | + if ($search_code != '' && $id == 9) { |
|
| 1056 | + $sql .= natural_search("code_iso", $search_code); |
|
| 1057 | + } |
|
| 1001 | 1058 | |
| 1002 | 1059 | if ($sortfield) { |
| 1003 | 1060 | // If sort order is "country", we use country_code instead |
| 1004 | - if ($sortfield == 'country') |
|
| 1005 | - $sortfield = 'country_code'; |
|
| 1061 | + if ($sortfield == 'country') { |
|
| 1062 | + $sortfield = 'country_code'; |
|
| 1063 | + } |
|
| 1006 | 1064 | $sql .= " ORDER BY " . $db->escape($sortfield); |
| 1007 | 1065 | if ($sortorder) { |
| 1008 | 1066 | $sql .= " " . strtoupper($db->escape($sortorder)); |
@@ -1065,10 +1123,11 @@ discard block |
||
| 1065 | 1123 | $valuetoshow = $langs->trans("PriceUHT"); |
| 1066 | 1124 | } |
| 1067 | 1125 | if ($fieldlist[$field] == 'taux') { |
| 1068 | - if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") |
|
| 1069 | - $valuetoshow = $langs->trans("Rate"); |
|
| 1070 | - else |
|
| 1071 | - $valuetoshow = $langs->trans("Amount"); |
|
| 1126 | + if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") { |
|
| 1127 | + $valuetoshow = $langs->trans("Rate"); |
|
| 1128 | + } else { |
|
| 1129 | + $valuetoshow = $langs->trans("Amount"); |
|
| 1130 | + } |
|
| 1072 | 1131 | $class = 'center'; |
| 1073 | 1132 | } |
| 1074 | 1133 | if ($fieldlist[$field] == 'localtax1_type') { |
@@ -1096,10 +1155,11 @@ discard block |
||
| 1096 | 1155 | $valuetoshow = $langs->trans("Language"); |
| 1097 | 1156 | } |
| 1098 | 1157 | if ($fieldlist[$field] == 'type') { |
| 1099 | - if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement") |
|
| 1100 | - $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); |
|
| 1101 | - else |
|
| 1102 | - $valuetoshow = $langs->trans("Type"); |
|
| 1158 | + if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement") { |
|
| 1159 | + $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); |
|
| 1160 | + } else { |
|
| 1161 | + $valuetoshow = $langs->trans("Type"); |
|
| 1162 | + } |
|
| 1103 | 1163 | } |
| 1104 | 1164 | if ($fieldlist[$field] == 'code') { |
| 1105 | 1165 | $valuetoshow = $langs->trans("Code"); |
@@ -1248,24 +1308,28 @@ discard block |
||
| 1248 | 1308 | |
| 1249 | 1309 | if ($valuetoshow != '') { |
| 1250 | 1310 | print '<td' . ($class ? ' class="' . $class . '"' : '') . '>'; |
| 1251 | - if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) |
|
| 1252 | - print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>'; |
|
| 1253 | - else if (!empty($tabhelp[$id][$value])) |
|
| 1254 | - print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); |
|
| 1255 | - else |
|
| 1256 | - print $valuetoshow; |
|
| 1311 | + if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { |
|
| 1312 | + print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>'; |
|
| 1313 | + } else if (!empty($tabhelp[$id][$value])) { |
|
| 1314 | + print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); |
|
| 1315 | + } else { |
|
| 1316 | + print $valuetoshow; |
|
| 1317 | + } |
|
| 1257 | 1318 | print '</td>'; |
| 1258 | 1319 | } |
| 1259 | - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') |
|
| 1260 | - $alabelisused = 1; |
|
| 1320 | + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { |
|
| 1321 | + $alabelisused = 1; |
|
| 1322 | + } |
|
| 1261 | 1323 | } |
| 1262 | 1324 | |
| 1263 | - if ($id == 4) |
|
| 1264 | - print '<td></td>'; |
|
| 1325 | + if ($id == 4) { |
|
| 1326 | + print '<td></td>'; |
|
| 1327 | + } |
|
| 1265 | 1328 | print '<td>'; |
| 1266 | 1329 | print '<input type="hidden" name="id" value="' . $id . '">'; |
| 1267 | - if (!is_null($withentity)) |
|
| 1268 | - print '<input type="hidden" name="entity" value="' . $withentity . '">'; |
|
| 1330 | + if (!is_null($withentity)) { |
|
| 1331 | + print '<input type="hidden" name="entity" value="' . $withentity . '">'; |
|
| 1332 | + } |
|
| 1269 | 1333 | print '</td>'; |
| 1270 | 1334 | print '<td style="min-width: 26px;"></td>'; |
| 1271 | 1335 | print '<td style="min-width: 26px;"></td>'; |
@@ -1278,8 +1342,9 @@ discard block |
||
| 1278 | 1342 | // If data was already input, we define them in obj to populate input fields. |
| 1279 | 1343 | if (GETPOST('actionadd')) { |
| 1280 | 1344 | foreach ($fieldlist as $key => $val) { |
| 1281 | - if (GETPOST($val) != '') |
|
| 1282 | - $obj->$val = GETPOST($val); |
|
| 1345 | + if (GETPOST($val) != '') { |
|
| 1346 | + $obj->$val = GETPOST($val); |
|
| 1347 | + } |
|
| 1283 | 1348 | } |
| 1284 | 1349 | } |
| 1285 | 1350 | |
@@ -1289,15 +1354,18 @@ discard block |
||
| 1289 | 1354 | $error = $hookmanager->error; |
| 1290 | 1355 | $errors = $hookmanager->errors; |
| 1291 | 1356 | |
| 1292 | - if ($id == 3) |
|
| 1293 | - unset($fieldlist[2]); // Remove field ??? if dictionary Regions |
|
| 1357 | + if ($id == 3) { |
|
| 1358 | + unset($fieldlist[2]); |
|
| 1359 | + } |
|
| 1360 | + // Remove field ??? if dictionary Regions |
|
| 1294 | 1361 | |
| 1295 | 1362 | if (empty($reshook)) { |
| 1296 | 1363 | fieldList($fieldlist, $obj, $tabname[$id], 'add'); |
| 1297 | 1364 | } |
| 1298 | 1365 | |
| 1299 | - if ($id == 4) |
|
| 1300 | - print '<td></td>'; |
|
| 1366 | + if ($id == 4) { |
|
| 1367 | + print '<td></td>'; |
|
| 1368 | + } |
|
| 1301 | 1369 | print '<td colspan="3" align="center">'; |
| 1302 | 1370 | if ($action != 'edit') { |
| 1303 | 1371 | print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">'; |
@@ -1306,8 +1374,9 @@ discard block |
||
| 1306 | 1374 | print "</tr>"; |
| 1307 | 1375 | |
| 1308 | 1376 | $colspan = count($fieldlist) + 3; |
| 1309 | - if ($id == 4) |
|
| 1310 | - $colspan++; |
|
| 1377 | + if ($id == 4) { |
|
| 1378 | + $colspan++; |
|
| 1379 | + } |
|
| 1311 | 1380 | |
| 1312 | 1381 | print '</table>'; |
| 1313 | 1382 | print '</div>'; |
@@ -1342,8 +1411,9 @@ discard block |
||
| 1342 | 1411 | print '<tr class="liste_titre_filter">'; |
| 1343 | 1412 | $filterfound = 0; |
| 1344 | 1413 | foreach ($fieldlist as $field => $value) { |
| 1345 | - if ($fieldlist[$field] == 'entity') |
|
| 1346 | - continue; |
|
| 1414 | + if ($fieldlist[$field] == 'entity') { |
|
| 1415 | + continue; |
|
| 1416 | + } |
|
| 1347 | 1417 | |
| 1348 | 1418 | $showfield = 1; // By default |
| 1349 | 1419 | |
@@ -1368,8 +1438,9 @@ discard block |
||
| 1368 | 1438 | } |
| 1369 | 1439 | } |
| 1370 | 1440 | } |
| 1371 | - if ($id == 4) |
|
| 1372 | - print '<td></td>'; |
|
| 1441 | + if ($id == 4) { |
|
| 1442 | + print '<td></td>'; |
|
| 1443 | + } |
|
| 1373 | 1444 | print '<td class="liste_titre"></td>'; |
| 1374 | 1445 | print '<td class="liste_titre" colspan="2" align="right">'; |
| 1375 | 1446 | if ($filterfound) { |
@@ -1382,8 +1453,9 @@ discard block |
||
| 1382 | 1453 | // Title of lines |
| 1383 | 1454 | print '<tr class="liste_titre">'; |
| 1384 | 1455 | foreach ($fieldlist as $field => $value) { |
| 1385 | - if ($fieldlist[$field] == 'entity') |
|
| 1386 | - continue; |
|
| 1456 | + if ($fieldlist[$field] == 'entity') { |
|
| 1457 | + continue; |
|
| 1458 | + } |
|
| 1387 | 1459 | |
| 1388 | 1460 | // Determine le nom du champ par rapport aux noms possibles |
| 1389 | 1461 | // dans les dictionnaires de donnees |
@@ -1407,10 +1479,11 @@ discard block |
||
| 1407 | 1479 | $valuetoshow = $langs->trans("PriceUHT"); |
| 1408 | 1480 | } |
| 1409 | 1481 | if ($fieldlist[$field] == 'taux') { |
| 1410 | - if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") |
|
| 1411 | - $valuetoshow = $langs->trans("Rate"); |
|
| 1412 | - else |
|
| 1413 | - $valuetoshow = $langs->trans("Amount"); |
|
| 1482 | + if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") { |
|
| 1483 | + $valuetoshow = $langs->trans("Rate"); |
|
| 1484 | + } else { |
|
| 1485 | + $valuetoshow = $langs->trans("Amount"); |
|
| 1486 | + } |
|
| 1414 | 1487 | $align = 'center'; |
| 1415 | 1488 | } |
| 1416 | 1489 | if ($fieldlist[$field] == 'localtax1_type') { |
@@ -1583,8 +1656,9 @@ discard block |
||
| 1583 | 1656 | } |
| 1584 | 1657 | } |
| 1585 | 1658 | // Favorite - Only activated on country dictionary |
| 1586 | - if ($id == 4) |
|
| 1587 | - print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 1659 | + if ($id == 4) { |
|
| 1660 | + print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 1661 | + } |
|
| 1588 | 1662 | |
| 1589 | 1663 | print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
| 1590 | 1664 | print getTitleFieldOfList(''); |
@@ -1613,13 +1687,13 @@ discard block |
||
| 1613 | 1687 | print '<div name="' . (!empty($obj->rowid) ? $obj->rowid : $obj->code) . '"></div>'; |
| 1614 | 1688 | print '<input type="hidden" name="page" value="' . $page . '">'; |
| 1615 | 1689 | print '<input type="hidden" name="rowid" value="' . $rowid . '">'; |
| 1616 | - if (!is_null($withentity)) |
|
| 1617 | - print '<input type="hidden" name="entity" value="' . $withentity . '">'; |
|
| 1690 | + if (!is_null($withentity)) { |
|
| 1691 | + print '<input type="hidden" name="entity" value="' . $withentity . '">'; |
|
| 1692 | + } |
|
| 1618 | 1693 | print '<input type="submit" class="button" name="actionmodify" value="' . $langs->trans("Modify") . '">'; |
| 1619 | 1694 | print '<input type="submit" class="button" name="actioncancel" value="' . $langs->trans("Cancel") . '">'; |
| 1620 | 1695 | print '</td>'; |
| 1621 | - } |
|
| 1622 | - else { |
|
| 1696 | + } else { |
|
| 1623 | 1697 | $tmpaction = 'view'; |
| 1624 | 1698 | $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); |
| 1625 | 1699 | $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
@@ -1658,15 +1732,15 @@ discard block |
||
| 1658 | 1732 | $valuetoshow = yn($valuetoshow); |
| 1659 | 1733 | $align = "center"; |
| 1660 | 1734 | } else if ($fieldlist[$field] == 'type_cdr') { |
| 1661 | - if (empty($valuetoshow)) |
|
| 1662 | - $valuetoshow = $langs->trans('None'); |
|
| 1663 | - elseif ($valuetoshow == 1) |
|
| 1664 | - $valuetoshow = $langs->trans('AtEndOfMonth'); |
|
| 1665 | - elseif ($valuetoshow == 2) |
|
| 1666 | - $valuetoshow = $langs->trans('CurrentNext'); |
|
| 1735 | + if (empty($valuetoshow)) { |
|
| 1736 | + $valuetoshow = $langs->trans('None'); |
|
| 1737 | + } elseif ($valuetoshow == 1) { |
|
| 1738 | + $valuetoshow = $langs->trans('AtEndOfMonth'); |
|
| 1739 | + } elseif ($valuetoshow == 2) { |
|
| 1740 | + $valuetoshow = $langs->trans('CurrentNext'); |
|
| 1741 | + } |
|
| 1667 | 1742 | $align = "center"; |
| 1668 | - } |
|
| 1669 | - else if ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) { |
|
| 1743 | + } else if ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) { |
|
| 1670 | 1744 | $valuetoshow = price($valuetoshow); |
| 1671 | 1745 | } |
| 1672 | 1746 | if ($value == 'private') { |
@@ -1744,20 +1818,20 @@ discard block |
||
| 1744 | 1818 | } else if ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') { |
| 1745 | 1819 | $align = "center"; |
| 1746 | 1820 | } else if ($fieldlist[$field] == 'localtax1_type') { |
| 1747 | - if ($obj->localtax1 != 0) |
|
| 1748 | - $valuetoshow = $localtax_typeList[$valuetoshow]; |
|
| 1749 | - else |
|
| 1750 | - $valuetoshow = ''; |
|
| 1821 | + if ($obj->localtax1 != 0) { |
|
| 1822 | + $valuetoshow = $localtax_typeList[$valuetoshow]; |
|
| 1823 | + } else { |
|
| 1824 | + $valuetoshow = ''; |
|
| 1825 | + } |
|
| 1751 | 1826 | $align = "center"; |
| 1752 | - } |
|
| 1753 | - else if ($fieldlist[$field] == 'localtax2_type') { |
|
| 1754 | - if ($obj->localtax2 != 0) |
|
| 1755 | - $valuetoshow = $localtax_typeList[$valuetoshow]; |
|
| 1756 | - else |
|
| 1757 | - $valuetoshow = ''; |
|
| 1827 | + } else if ($fieldlist[$field] == 'localtax2_type') { |
|
| 1828 | + if ($obj->localtax2 != 0) { |
|
| 1829 | + $valuetoshow = $localtax_typeList[$valuetoshow]; |
|
| 1830 | + } else { |
|
| 1831 | + $valuetoshow = ''; |
|
| 1832 | + } |
|
| 1758 | 1833 | $align = "center"; |
| 1759 | - } |
|
| 1760 | - else if ($fieldlist[$field] == 'taux') { |
|
| 1834 | + } else if ($fieldlist[$field] == 'taux') { |
|
| 1761 | 1835 | $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); |
| 1762 | 1836 | $align = "center"; |
| 1763 | 1837 | } else if (in_array($fieldlist[$field], array('recuperableonly'))) { |
@@ -1779,21 +1853,28 @@ discard block |
||
| 1779 | 1853 | } |
| 1780 | 1854 | |
| 1781 | 1855 | $class = 'tddict'; |
| 1782 | - if ($fieldlist[$field] == 'note' && $id == 10) |
|
| 1783 | - $class .= ' tdoverflowmax200'; |
|
| 1784 | - if ($fieldlist[$field] == 'tracking') |
|
| 1785 | - $class .= ' tdoverflowauto'; |
|
| 1786 | - if ($fieldlist[$field] == 'code') |
|
| 1787 | - $class .= ' width100'; |
|
| 1788 | - if ($fieldlist[$field] == 'position') |
|
| 1789 | - $class .= ' right'; |
|
| 1790 | - if ($fieldlist[$field] == 'localtax1_type') |
|
| 1791 | - $class .= ' nowrap'; |
|
| 1792 | - if ($fieldlist[$field] == 'localtax2_type') |
|
| 1793 | - $class .= ' nowrap'; |
|
| 1856 | + if ($fieldlist[$field] == 'note' && $id == 10) { |
|
| 1857 | + $class .= ' tdoverflowmax200'; |
|
| 1858 | + } |
|
| 1859 | + if ($fieldlist[$field] == 'tracking') { |
|
| 1860 | + $class .= ' tdoverflowauto'; |
|
| 1861 | + } |
|
| 1862 | + if ($fieldlist[$field] == 'code') { |
|
| 1863 | + $class .= ' width100'; |
|
| 1864 | + } |
|
| 1865 | + if ($fieldlist[$field] == 'position') { |
|
| 1866 | + $class .= ' right'; |
|
| 1867 | + } |
|
| 1868 | + if ($fieldlist[$field] == 'localtax1_type') { |
|
| 1869 | + $class .= ' nowrap'; |
|
| 1870 | + } |
|
| 1871 | + if ($fieldlist[$field] == 'localtax2_type') { |
|
| 1872 | + $class .= ' nowrap'; |
|
| 1873 | + } |
|
| 1794 | 1874 | // Show value for field |
| 1795 | - if ($showfield) |
|
| 1796 | - print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>'; |
|
| 1875 | + if ($showfield) { |
|
| 1876 | + print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>'; |
|
| 1877 | + } |
|
| 1797 | 1878 | } |
| 1798 | 1879 | } |
| 1799 | 1880 | |
@@ -1822,66 +1903,76 @@ discard block |
||
| 1822 | 1903 | $canbedisabled = 0; |
| 1823 | 1904 | } |
| 1824 | 1905 | $canbemodified = $iserasable; |
| 1825 | - if ($obj->code == 'RECEP') |
|
| 1826 | - $canbemodified = 1; |
|
| 1827 | - if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm") |
|
| 1828 | - $canbemodified = 1; |
|
| 1906 | + if ($obj->code == 'RECEP') { |
|
| 1907 | + $canbemodified = 1; |
|
| 1908 | + } |
|
| 1909 | + if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm") { |
|
| 1910 | + $canbemodified = 1; |
|
| 1911 | + } |
|
| 1829 | 1912 | |
| 1830 | 1913 | // Url |
| 1831 | 1914 | $rowidcol = $tabrowid[$id]; |
| 1832 | 1915 | // If rowidcol not defined |
| 1833 | - if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27))) |
|
| 1834 | - $rowidcol = 'rowid'; |
|
| 1916 | + if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27))) { |
|
| 1917 | + $rowidcol = 'rowid'; |
|
| 1918 | + } |
|
| 1835 | 1919 | //$url = $_SERVER["PHP_SELF"] . '?' . ($page ? 'page=' . $page . '&' : '') . 'sortfield=' . $sortfield . '&sortorder=' . $sortorder . '&rowid=' . ((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')) . '&code=' . (!empty($obj->code) ? urlencode($obj->code) : ''); |
| 1836 | 1920 | $url = BASE_URI . '?controller=admin&method=dict&' . ($page ? 'page=' . $page . '&' : '') . 'sortfield=' . $sortfield . '&sortorder=' . $sortorder . '&rowid=' . ((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')) . '&code=' . (!empty($obj->code) ? urlencode($obj->code) : ''); |
| 1837 | - if (!empty($param)) |
|
| 1838 | - $url .= '&' . $param; |
|
| 1839 | - if (!is_null($withentity)) |
|
| 1840 | - $url .= '&entity=' . $withentity; |
|
| 1921 | + if (!empty($param)) { |
|
| 1922 | + $url .= '&' . $param; |
|
| 1923 | + } |
|
| 1924 | + if (!is_null($withentity)) { |
|
| 1925 | + $url .= '&entity=' . $withentity; |
|
| 1926 | + } |
|
| 1841 | 1927 | $url .= '&'; |
| 1842 | 1928 | |
| 1843 | 1929 | // Favorite |
| 1844 | 1930 | // Only activated on country dictionary |
| 1845 | 1931 | if ($id == 4) { |
| 1846 | 1932 | print '<td align="center" class="nowrap">'; |
| 1847 | - if ($iserasable) |
|
| 1848 | - print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>'; |
|
| 1849 | - else |
|
| 1850 | - print $langs->trans("AlwaysActive"); |
|
| 1933 | + if ($iserasable) { |
|
| 1934 | + print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>'; |
|
| 1935 | + } else { |
|
| 1936 | + print $langs->trans("AlwaysActive"); |
|
| 1937 | + } |
|
| 1851 | 1938 | print '</td>'; |
| 1852 | 1939 | } |
| 1853 | 1940 | |
| 1854 | 1941 | // Active |
| 1855 | 1942 | print '<td align="center" class="nowrap">'; |
| 1856 | - if ($canbedisabled) |
|
| 1857 | - print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>'; |
|
| 1858 | - else { |
|
| 1859 | - if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO'))) |
|
| 1860 | - print $langs->trans("AlwaysActive"); |
|
| 1861 | - else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) |
|
| 1862 | - print $langs->trans("Deprecated"); |
|
| 1863 | - else if (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH') |
|
| 1864 | - print $langs->trans("UsedOnlyWithTypeOption"); |
|
| 1865 | - else |
|
| 1866 | - print $langs->trans("AlwaysActive"); |
|
| 1943 | + if ($canbedisabled) { |
|
| 1944 | + print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>'; |
|
| 1945 | + } else { |
|
| 1946 | + if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO'))) { |
|
| 1947 | + print $langs->trans("AlwaysActive"); |
|
| 1948 | + } else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) { |
|
| 1949 | + print $langs->trans("Deprecated"); |
|
| 1950 | + } else if (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH') { |
|
| 1951 | + print $langs->trans("UsedOnlyWithTypeOption"); |
|
| 1952 | + } else { |
|
| 1953 | + print $langs->trans("AlwaysActive"); |
|
| 1954 | + } |
|
| 1867 | 1955 | } |
| 1868 | 1956 | print "</td>"; |
| 1869 | 1957 | |
| 1870 | 1958 | // Modify link |
| 1871 | - if ($canbemodified) |
|
| 1872 | - print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>'; |
|
| 1873 | - else |
|
| 1874 | - print '<td> </td>'; |
|
| 1959 | + if ($canbemodified) { |
|
| 1960 | + print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>'; |
|
| 1961 | + } else { |
|
| 1962 | + print '<td> </td>'; |
|
| 1963 | + } |
|
| 1875 | 1964 | |
| 1876 | 1965 | // Delete link |
| 1877 | 1966 | if ($iserasable) { |
| 1878 | 1967 | print '<td align="center">'; |
| 1879 | - if ($user->admin) |
|
| 1880 | - print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>'; |
|
| 1968 | + if ($user->admin) { |
|
| 1969 | + print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>'; |
|
| 1970 | + } |
|
| 1881 | 1971 | //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin |
| 1882 | 1972 | print '</td>'; |
| 1883 | - } else |
|
| 1884 | - print '<td> </td>'; |
|
| 1973 | + } else { |
|
| 1974 | + print '<td> </td>'; |
|
| 1975 | + } |
|
| 1885 | 1976 | |
| 1886 | 1977 | print "</tr>\n"; |
| 1887 | 1978 | } |
@@ -1891,8 +1982,7 @@ discard block |
||
| 1891 | 1982 | |
| 1892 | 1983 | print '</table>'; |
| 1893 | 1984 | print '</div>'; |
| 1894 | - } |
|
| 1895 | - else { |
|
| 1985 | + } else { |
|
| 1896 | 1986 | dol_print_error($db); |
| 1897 | 1987 | } |
| 1898 | 1988 | |
@@ -1915,8 +2005,9 @@ discard block |
||
| 1915 | 2005 | |
| 1916 | 2006 | $showemptyline = ''; |
| 1917 | 2007 | foreach ($taborder as $i) { |
| 1918 | - if (isset($tabname[$i]) && empty($tabcond[$i])) |
|
| 1919 | - continue; |
|
| 2008 | + if (isset($tabname[$i]) && empty($tabcond[$i])) { |
|
| 2009 | + continue; |
|
| 2010 | + } |
|
| 1920 | 2011 | |
| 1921 | 2012 | if ($i) { |
| 1922 | 2013 | if ($showemptyline) { |
@@ -1979,8 +2070,9 @@ discard block |
||
| 1979 | 2070 | |
| 1980 | 2071 | $formadmin = new FormAdmin($db); |
| 1981 | 2072 | $formcompany = new FormCompany($db); |
| 1982 | - if (!empty($conf->accounting->enabled)) |
|
| 1983 | - $formaccounting = new FormAccounting($db); |
|
| 2073 | + if (!empty($conf->accounting->enabled)) { |
|
| 2074 | + $formaccounting = new FormAccounting($db); |
|
| 2075 | + } |
|
| 1984 | 2076 | |
| 1985 | 2077 | $withentity = ''; |
| 1986 | 2078 | |
@@ -2049,10 +2141,11 @@ discard block |
||
| 2049 | 2141 | print $type . '<input type="hidden" name="type" value="' . $type . '">'; |
| 2050 | 2142 | print '</td>'; |
| 2051 | 2143 | } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { |
| 2052 | - if ($fieldlist[$field] == 'type_cdr') |
|
| 2053 | - print '<td align="center">'; |
|
| 2054 | - else |
|
| 2055 | - print '<td>'; |
|
| 2144 | + if ($fieldlist[$field] == 'type_cdr') { |
|
| 2145 | + print '<td align="center">'; |
|
| 2146 | + } else { |
|
| 2147 | + print '<td>'; |
|
| 2148 | + } |
|
| 2056 | 2149 | if ($fieldlist[$field] == 'type_cdr') { |
| 2057 | 2150 | print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')); |
| 2058 | 2151 | } else { |
@@ -2061,13 +2154,14 @@ discard block |
||
| 2061 | 2154 | print '</td>'; |
| 2062 | 2155 | } elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) { |
| 2063 | 2156 | $align = "left"; |
| 2064 | - if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) |
|
| 2065 | - $align = "center"; // Fields aligned on right |
|
| 2157 | + if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) { |
|
| 2158 | + $align = "center"; |
|
| 2159 | + } |
|
| 2160 | + // Fields aligned on right |
|
| 2066 | 2161 | print '<td align="' . $align . '">'; |
| 2067 | 2162 | print '<input type="text" class="flat" value="' . (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" size="3" name="' . $fieldlist[$field] . '">'; |
| 2068 | 2163 | print '</td>'; |
| 2069 | - } |
|
| 2070 | - elseif (in_array($fieldlist[$field], array('libelle_facture'))) { |
|
| 2164 | + } elseif (in_array($fieldlist[$field], array('libelle_facture'))) { |
|
| 2071 | 2165 | print '<td>'; |
| 2072 | 2166 | $transfound = 0; |
| 2073 | 2167 | // Special case for labels |
@@ -2127,25 +2221,33 @@ discard block |
||
| 2127 | 2221 | print $form->selectExpenseRanges($obj->fk_range); |
| 2128 | 2222 | print '</td>'; |
| 2129 | 2223 | } else { |
| 2130 | - if ($fieldlist[$field] == 'sortorder') |
|
| 2131 | - $fieldlist[$field] = 'position'; |
|
| 2224 | + if ($fieldlist[$field] == 'sortorder') { |
|
| 2225 | + $fieldlist[$field] = 'position'; |
|
| 2226 | + } |
|
| 2132 | 2227 | |
| 2133 | 2228 | $classtd = ''; |
| 2134 | 2229 | $class = ''; |
| 2135 | - if ($fieldlist[$field] == 'code') |
|
| 2136 | - $classtd = 'width100'; |
|
| 2137 | - if ($fieldlist[$field] == 'affect') |
|
| 2138 | - $class = 'maxwidth50'; |
|
| 2139 | - if ($fieldlist[$field] == 'delay') |
|
| 2140 | - $class = 'maxwidth50'; |
|
| 2141 | - if ($fieldlist[$field] == 'position') |
|
| 2142 | - $class = 'maxwidth50'; |
|
| 2143 | - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') |
|
| 2144 | - $class = 'quatrevingtpercent'; |
|
| 2145 | - if ($fieldlist[$field] == 'tracking') |
|
| 2146 | - $class = 'quatrevingtpercent'; |
|
| 2147 | - if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') |
|
| 2148 | - $class = 'maxwidth50'; |
|
| 2230 | + if ($fieldlist[$field] == 'code') { |
|
| 2231 | + $classtd = 'width100'; |
|
| 2232 | + } |
|
| 2233 | + if ($fieldlist[$field] == 'affect') { |
|
| 2234 | + $class = 'maxwidth50'; |
|
| 2235 | + } |
|
| 2236 | + if ($fieldlist[$field] == 'delay') { |
|
| 2237 | + $class = 'maxwidth50'; |
|
| 2238 | + } |
|
| 2239 | + if ($fieldlist[$field] == 'position') { |
|
| 2240 | + $class = 'maxwidth50'; |
|
| 2241 | + } |
|
| 2242 | + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { |
|
| 2243 | + $class = 'quatrevingtpercent'; |
|
| 2244 | + } |
|
| 2245 | + if ($fieldlist[$field] == 'tracking') { |
|
| 2246 | + $class = 'quatrevingtpercent'; |
|
| 2247 | + } |
|
| 2248 | + if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') { |
|
| 2249 | + $class = 'maxwidth50'; |
|
| 2250 | + } |
|
| 2149 | 2251 | print '<td class="' . $classtd . '">'; |
| 2150 | 2252 | $transfound = 0; |
| 2151 | 2253 | if (in_array($fieldlist[$field], array('label', 'libelle'))) { |
@@ -30,15 +30,15 @@ |
||
| 30 | 30 | * @param string $replaceimagepath Replace path to image with another path. Exemple: ('doc/'=>'xxx/aaa/')
|
| 31 | 31 | * @return string Parsed content |
| 32 | 32 | */ |
| 33 | -function dolMd2Html($content, $parser='parsedown',$replaceimagepath=null) |
|
| 33 | +function dolMd2Html($content, $parser = 'parsedown', $replaceimagepath = null) |
|
| 34 | 34 | {
|
| 35 | 35 | if (is_array($replaceimagepath)) |
| 36 | 36 | {
|
| 37 | - foreach($replaceimagepath as $key => $val) |
|
| 37 | + foreach ($replaceimagepath as $key => $val) |
|
| 38 | 38 | {
|
| 39 | 39 | $keytoreplace = ']('.$key;
|
| 40 | 40 | $valafter = ']('.$val;
|
| 41 | - $content = preg_replace('/'.preg_quote($keytoreplace,'/').'/m', $valafter, $content);
|
|
| 41 | + $content = preg_replace('/'.preg_quote($keytoreplace, '/').'/m', $valafter, $content);
|
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | if ($parser == 'parsedown') |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | // include_once DOL_DOCUMENT_ROOT.'/includes/parsedown/Parsedown.php'; |
| 47 | 47 | $Parsedown = new Parsedown(); |
| 48 | 48 | $content = $Parsedown->text($content); |
| 49 | - } |
|
| 50 | - else |
|
| 49 | + } else |
|
| 51 | 50 | {
|
| 52 | 51 | $content = nl2br($content); |
| 53 | 52 | } |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | |
| 27 | 27 | // Filters |
| 28 | - const NO_CHECK = 0; // 'none'=no check (only for param that should have very rich content) |
|
| 29 | - const NUMERIC = 1; // 'int'=check it's numeric (integer or float) |
|
| 30 | - const NUMBER_COMMA = 2; // 'intcomma'=check it's integer+comma ('1,2,3,4...') |
|
| 31 | - const ALPHA = 3; // 'alpha'=check it's text and sign |
|
| 32 | - const LETTERS_ONLY = 4; // 'aZ'=check it's a-z only |
|
| 33 | - const LETTERS_AND_NUMBERS = 5; // 'aZ09'=check it's simple alpha string (recommended for keys) |
|
| 34 | - const AN_ARRAY = 6; // 'array'=check it's array |
|
| 35 | - const SANITIZE = 7; // 'san_alpha' = Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string) |
|
| 36 | - const NO_HTML = 8; // 'nohtml', 'alphanohtml' = check there is no html content |
|
| 37 | - const ALPHA_NO_HTML = 9; // 'nohtml', 'alphanohtml' = check there is no html content |
|
| 38 | - const CUSTOM = 10; // 'custom' = custom filter specify $filter and $options) |
|
| 28 | + const NO_CHECK = 0; // 'none'=no check (only for param that should have very rich content) |
|
| 29 | + const NUMERIC = 1; // 'int'=check it's numeric (integer or float) |
|
| 30 | + const NUMBER_COMMA = 2; // 'intcomma'=check it's integer+comma ('1,2,3,4...') |
|
| 31 | + const ALPHA = 3; // 'alpha'=check it's text and sign |
|
| 32 | + const LETTERS_ONLY = 4; // 'aZ'=check it's a-z only |
|
| 33 | + const LETTERS_AND_NUMBERS = 5; // 'aZ09'=check it's simple alpha string (recommended for keys) |
|
| 34 | + const AN_ARRAY = 6; // 'array'=check it's array |
|
| 35 | + const SANITIZE = 7; // 'san_alpha' = Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string) |
|
| 36 | + const NO_HTML = 8; // 'nohtml', 'alphanohtml' = check there is no html content |
|
| 37 | + const ALPHA_NO_HTML = 9; // 'nohtml', 'alphanohtml' = check there is no html content |
|
| 38 | + const CUSTOM = 10; // 'custom' = custom filter specify $filter and $options) |
|
| 39 | 39 | |
| 40 | 40 | public static function get(string $variable, array $methods = [INPUT_GET, INPUT_POST], int $filter = self::NO_CHECK): string |
| 41 | 41 | { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if (empty($paramname)) |
| 178 | 178 | return 'BadFirstParameterForGETPOST'; |
| 179 | 179 | if (empty($check)) { |
| 180 | - dol_syslog("Deprecated use of GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING); |
|
| 180 | + dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and 2nd param is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING); |
|
| 181 | 181 | // Enable this line to know who call the GETPOST with '' $check parameter. |
| 182 | 182 | //var_dump(debug_backtrace()[0]); |
| 183 | 183 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $relativepathstring = $_SERVER["PHP_SELF"]; |
| 200 | 200 | // Clean $relativepathstring |
| 201 | 201 | if (constant('DOL_URL_ROOT')) |
| 202 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
| 202 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring); |
|
| 203 | 203 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
| 204 | 204 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
| 205 | 205 | //var_dump($relativepathstring); |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | // Code for search criteria persistence. |
| 208 | 208 | // Retrieve values if restore_lastsearch_values |
| 209 | 209 | if (!empty($_GET['restore_lastsearch_values'])) { // Use $_GET here and not GETPOST |
| 210 | - if (!empty($_SESSION['lastsearch_values_' . $relativepathstring])) { // If there is saved values |
|
| 211 | - $tmp = json_decode($_SESSION['lastsearch_values_' . $relativepathstring], true); |
|
| 210 | + if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) { // If there is saved values |
|
| 211 | + $tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); |
|
| 212 | 212 | if (is_array($tmp)) { |
| 213 | 213 | foreach ($tmp as $key => $val) { |
| 214 | 214 | if ($key == $paramname) { // We are on the requested parameter |
@@ -219,12 +219,12 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | // If there is saved contextpage, page or limit |
| 222 | - if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_' . $relativepathstring])) { |
|
| 223 | - $out = $_SESSION['lastsearch_contextpage_' . $relativepathstring]; |
|
| 224 | - } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_' . $relativepathstring])) { |
|
| 225 | - $out = $_SESSION['lastsearch_page_' . $relativepathstring]; |
|
| 226 | - } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_' . $relativepathstring])) { |
|
| 227 | - $out = $_SESSION['lastsearch_limit_' . $relativepathstring]; |
|
| 222 | + if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) { |
|
| 223 | + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; |
|
| 224 | + } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) { |
|
| 225 | + $out = $_SESSION['lastsearch_page_'.$relativepathstring]; |
|
| 226 | + } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) { |
|
| 227 | + $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | // Else, retreive default values if we are not doing a sort |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $qualified = 1; |
| 293 | 293 | |
| 294 | 294 | if ($qualified) { |
| 295 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
| 295 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
| 296 | 296 | foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) { |
| 297 | 297 | if ($out) |
| 298 | 298 | $out .= ', '; |
@@ -328,11 +328,11 @@ discard block |
||
| 328 | 328 | if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) { |
| 329 | 329 | // We made a search from quick search menu, do we still use default filter ? |
| 330 | 330 | if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) { |
| 331 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
| 331 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
| 332 | 332 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
| 333 | 333 | } |
| 334 | 334 | } else { |
| 335 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
| 335 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
| 336 | 336 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
| 337 | 337 | } |
| 338 | 338 | break; |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. |
| 351 | 351 | if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) { |
| 352 | 352 | $maxloop = 20; |
| 353 | - $loopnb = 0; // Protection against infinite loop |
|
| 353 | + $loopnb = 0; // Protection against infinite loop |
|
| 354 | 354 | while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) { // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. |
| 355 | 355 | $loopnb++; |
| 356 | 356 | $newout = ''; |
@@ -395,9 +395,9 @@ discard block |
||
| 395 | 395 | } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') { |
| 396 | 396 | $newout = $conf->entity; |
| 397 | 397 | } else |
| 398 | - $newout = ''; // Key not found, we replace with empty string |
|
| 398 | + $newout = ''; // Key not found, we replace with empty string |
|
| 399 | 399 | //var_dump('__'.$reg[1].'__ -> '.$newout); |
| 400 | - $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out); |
|
| 400 | + $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
@@ -79,15 +79,17 @@ discard block |
||
| 79 | 79 | case self::LETTERS_ONLY:// 'aZ'=check it's a-z only |
| 80 | 80 | if (!is_array($result)) { |
| 81 | 81 | $out = trim($result); |
| 82 | - if (preg_match('/[^a-z]+/i', $result)) |
|
| 83 | - $result = ''; |
|
| 82 | + if (preg_match('/[^a-z]+/i', $result)) { |
|
| 83 | + $result = ''; |
|
| 84 | + } |
|
| 84 | 85 | } |
| 85 | 86 | break; |
| 86 | 87 | case self::LETTERS_AND_NUMBERS:// 'aZ09'=check it's simple alpha string (recommended for keys) |
| 87 | 88 | if (!is_array($result)) { |
| 88 | 89 | $result = trim($result); |
| 89 | - if (preg_match('/[^a-z0-9_\-\.]+/i', $result)) |
|
| 90 | - $result = ''; |
|
| 90 | + if (preg_match('/[^a-z0-9_\-\.]+/i', $result)) { |
|
| 91 | + $result = ''; |
|
| 92 | + } |
|
| 91 | 93 | } |
| 92 | 94 | break; |
| 93 | 95 | case self::AN_ARRAY :// 'array'=check it's array |
@@ -174,32 +176,35 @@ discard block |
||
| 174 | 176 | |
| 175 | 177 | Debug::addMessage('Deprecated', 'Using GETPOST of functions.lib.php instead of Request library'); |
| 176 | 178 | |
| 177 | - if (empty($paramname)) |
|
| 178 | - return 'BadFirstParameterForGETPOST'; |
|
| 179 | + if (empty($paramname)) { |
|
| 180 | + return 'BadFirstParameterForGETPOST'; |
|
| 181 | + } |
|
| 179 | 182 | if (empty($check)) { |
| 180 | 183 | dol_syslog("Deprecated use of GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING); |
| 181 | 184 | // Enable this line to know who call the GETPOST with '' $check parameter. |
| 182 | 185 | //var_dump(debug_backtrace()[0]); |
| 183 | 186 | } |
| 184 | 187 | |
| 185 | - if (empty($method)) |
|
| 186 | - $out = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] : ''); |
|
| 187 | - elseif ($method == 1) |
|
| 188 | - $out = isset($_GET[$paramname]) ? $_GET[$paramname] : ''; |
|
| 189 | - elseif ($method == 2) |
|
| 190 | - $out = isset($_POST[$paramname]) ? $_POST[$paramname] : ''; |
|
| 191 | - elseif ($method == 3) |
|
| 192 | - $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : ''); |
|
| 193 | - elseif ($method == 4) |
|
| 194 | - $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_COOKIE[$paramname]) ? $_COOKIE[$paramname] : '')); |
|
| 195 | - else |
|
| 196 | - return 'BadThirdParameterForGETPOST'; |
|
| 188 | + if (empty($method)) { |
|
| 189 | + $out = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] : ''); |
|
| 190 | + } elseif ($method == 1) { |
|
| 191 | + $out = isset($_GET[$paramname]) ? $_GET[$paramname] : ''; |
|
| 192 | + } elseif ($method == 2) { |
|
| 193 | + $out = isset($_POST[$paramname]) ? $_POST[$paramname] : ''; |
|
| 194 | + } elseif ($method == 3) { |
|
| 195 | + $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : ''); |
|
| 196 | + } elseif ($method == 4) { |
|
| 197 | + $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_COOKIE[$paramname]) ? $_COOKIE[$paramname] : '')); |
|
| 198 | + } else { |
|
| 199 | + return 'BadThirdParameterForGETPOST'; |
|
| 200 | + } |
|
| 197 | 201 | |
| 198 | 202 | if (empty($method) || $method == 3 || $method == 4) { |
| 199 | 203 | $relativepathstring = $_SERVER["PHP_SELF"]; |
| 200 | 204 | // Clean $relativepathstring |
| 201 | - if (constant('DOL_URL_ROOT')) |
|
| 202 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
| 205 | + if (constant('DOL_URL_ROOT')) { |
|
| 206 | + $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
| 207 | + } |
|
| 203 | 208 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
| 204 | 209 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
| 205 | 210 | //var_dump($relativepathstring); |
@@ -248,14 +253,17 @@ discard block |
||
| 248 | 253 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
| 249 | 254 | $foundintru = 0; |
| 250 | 255 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
| 251 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 252 | - $foundintru = 1; |
|
| 256 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 257 | + $foundintru = 1; |
|
| 258 | + } |
|
| 259 | + } |
|
| 260 | + if (!$foundintru) { |
|
| 261 | + $qualified = 1; |
|
| 253 | 262 | } |
| 254 | - if (!$foundintru) |
|
| 255 | - $qualified = 1; |
|
| 256 | -//var_dump($defkey.'-'.$qualified); |
|
| 257 | - } else |
|
| 258 | - $qualified = 1; |
|
| 263 | + //var_dump($defkey.'-'.$qualified); |
|
| 264 | + } else { |
|
| 265 | + $qualified = 1; |
|
| 266 | + } |
|
| 259 | 267 | |
| 260 | 268 | if ($qualified) { |
| 261 | 269 | //var_dump($user->default_values[$relativepathstring][$defkey]['createform']); |
@@ -282,20 +290,24 @@ discard block |
||
| 282 | 290 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
| 283 | 291 | $foundintru = 0; |
| 284 | 292 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
| 285 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 286 | - $foundintru = 1; |
|
| 293 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 294 | + $foundintru = 1; |
|
| 295 | + } |
|
| 287 | 296 | } |
| 288 | - if (!$foundintru) |
|
| 289 | - $qualified = 1; |
|
| 290 | -//var_dump($defkey.'-'.$qualified); |
|
| 291 | - } else |
|
| 292 | - $qualified = 1; |
|
| 297 | + if (!$foundintru) { |
|
| 298 | + $qualified = 1; |
|
| 299 | + } |
|
| 300 | + //var_dump($defkey.'-'.$qualified); |
|
| 301 | + } else { |
|
| 302 | + $qualified = 1; |
|
| 303 | + } |
|
| 293 | 304 | |
| 294 | 305 | if ($qualified) { |
| 295 | 306 | $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
| 296 | 307 | foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) { |
| 297 | - if ($out) |
|
| 298 | - $out .= ', '; |
|
| 308 | + if ($out) { |
|
| 309 | + $out .= ', '; |
|
| 310 | + } |
|
| 299 | 311 | if ($paramname == 'sortfield') { |
| 300 | 312 | $out .= dol_string_nospecial($key, '', $forbidden_chars_to_replace); |
| 301 | 313 | } |
@@ -315,14 +327,17 @@ discard block |
||
| 315 | 327 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
| 316 | 328 | $foundintru = 0; |
| 317 | 329 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
| 318 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 319 | - $foundintru = 1; |
|
| 330 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 331 | + $foundintru = 1; |
|
| 332 | + } |
|
| 320 | 333 | } |
| 321 | - if (!$foundintru) |
|
| 322 | - $qualified = 1; |
|
| 323 | -//var_dump($defkey.'-'.$qualified); |
|
| 324 | - } else |
|
| 325 | - $qualified = 1; |
|
| 334 | + if (!$foundintru) { |
|
| 335 | + $qualified = 1; |
|
| 336 | + } |
|
| 337 | + //var_dump($defkey.'-'.$qualified); |
|
| 338 | + } else { |
|
| 339 | + $qualified = 1; |
|
| 340 | + } |
|
| 326 | 341 | |
| 327 | 342 | if ($qualified) { |
| 328 | 343 | if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) { |
@@ -394,8 +409,10 @@ discard block |
||
| 394 | 409 | $newout = $user->fk_user; |
| 395 | 410 | } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') { |
| 396 | 411 | $newout = $conf->entity; |
| 397 | - } else |
|
| 398 | - $newout = ''; // Key not found, we replace with empty string |
|
| 412 | + } else { |
|
| 413 | + $newout = ''; |
|
| 414 | + } |
|
| 415 | + // Key not found, we replace with empty string |
|
| 399 | 416 | //var_dump('__'.$reg[1].'__ -> '.$newout); |
| 400 | 417 | $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out); |
| 401 | 418 | } |
@@ -412,18 +429,20 @@ discard block |
||
| 412 | 429 | } |
| 413 | 430 | break; |
| 414 | 431 | case 'intcomma': |
| 415 | - if (preg_match('/[^0-9,-]+/i', $out)) |
|
| 416 | - $out = ''; |
|
| 432 | + if (preg_match('/[^0-9,-]+/i', $out)) { |
|
| 433 | + $out = ''; |
|
| 434 | + } |
|
| 417 | 435 | break; |
| 418 | 436 | case 'alpha': |
| 419 | 437 | if (!is_array($out)) { |
| 420 | 438 | $out = trim($out); |
| 421 | 439 | // '"' is dangerous because param in url can close the href= or src= and add javascript functions. |
| 422 | 440 | // '../' is dangerous because it allows dir transversals |
| 423 | - if (preg_match('/"/', $out)) |
|
| 424 | - $out = ''; |
|
| 425 | - else if (preg_match('/\.\.\//', $out)) |
|
| 426 | - $out = ''; |
|
| 441 | + if (preg_match('/"/', $out)) { |
|
| 442 | + $out = ''; |
|
| 443 | + } else if (preg_match('/\.\.\//', $out)) { |
|
| 444 | + $out = ''; |
|
| 445 | + } |
|
| 427 | 446 | } |
| 428 | 447 | break; |
| 429 | 448 | case 'san_alpha': |
@@ -432,27 +451,31 @@ discard block |
||
| 432 | 451 | case 'aZ': |
| 433 | 452 | if (!is_array($out)) { |
| 434 | 453 | $out = trim($out); |
| 435 | - if (preg_match('/[^a-z]+/i', $out)) |
|
| 436 | - $out = ''; |
|
| 454 | + if (preg_match('/[^a-z]+/i', $out)) { |
|
| 455 | + $out = ''; |
|
| 456 | + } |
|
| 437 | 457 | } |
| 438 | 458 | break; |
| 439 | 459 | case 'aZ09': |
| 440 | 460 | if (!is_array($out)) { |
| 441 | 461 | $out = trim($out); |
| 442 | - if (preg_match('/[^a-z0-9_\-\.]+/i', $out)) |
|
| 443 | - $out = ''; |
|
| 462 | + if (preg_match('/[^a-z0-9_\-\.]+/i', $out)) { |
|
| 463 | + $out = ''; |
|
| 464 | + } |
|
| 444 | 465 | } |
| 445 | 466 | break; |
| 446 | 467 | case 'aZ09comma': // great to sanitize sortfield or sortorder params that can be t.abc,t.def_gh |
| 447 | 468 | if (!is_array($out)) { |
| 448 | 469 | $out = trim($out); |
| 449 | - if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) |
|
| 450 | - $out = ''; |
|
| 470 | + if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) { |
|
| 471 | + $out = ''; |
|
| 472 | + } |
|
| 451 | 473 | } |
| 452 | 474 | break; |
| 453 | 475 | case 'array': |
| 454 | - if (!is_array($out) || empty($out)) |
|
| 455 | - $out = array(); |
|
| 476 | + if (!is_array($out) || empty($out)) { |
|
| 477 | + $out = array(); |
|
| 478 | + } |
|
| 456 | 479 | break; |
| 457 | 480 | case 'nohtml': // Recommended for most scalar parameters |
| 458 | 481 | $out = dol_string_nohtmltag($out, 0); |
@@ -462,16 +485,18 @@ discard block |
||
| 462 | 485 | $out = trim($out); |
| 463 | 486 | // '"' is dangerous because param in url can close the href= or src= and add javascript functions. |
| 464 | 487 | // '../' is dangerous because it allows dir transversals |
| 465 | - if (preg_match('/"/', $out)) |
|
| 466 | - $out = ''; |
|
| 467 | - else if (preg_match('/\.\.\//', $out)) |
|
| 468 | - $out = ''; |
|
| 488 | + if (preg_match('/"/', $out)) { |
|
| 489 | + $out = ''; |
|
| 490 | + } else if (preg_match('/\.\.\//', $out)) { |
|
| 491 | + $out = ''; |
|
| 492 | + } |
|
| 469 | 493 | $out = dol_string_nohtmltag($out); |
| 470 | 494 | } |
| 471 | 495 | break; |
| 472 | 496 | case 'custom': |
| 473 | - if (empty($filter)) |
|
| 474 | - return 'BadFourthParameterForGETPOST'; |
|
| 497 | + if (empty($filter)) { |
|
| 498 | + return 'BadFourthParameterForGETPOST'; |
|
| 499 | + } |
|
| 475 | 500 | $out = filter_var($out, $filter, $options); |
| 476 | 501 | break; |
| 477 | 502 | } |