FIX #yogosha5746

This commit is contained in:
Laurent Destailleur 2021-03-29 15:07:23 +02:00
parent e03fbda96a
commit ce1f8289a4
20 changed files with 40 additions and 38 deletions

View File

@ -1387,7 +1387,7 @@ if (empty($reshook)) {
} elseif ($action == 'swapstatut') {
// Toggle the status of a contact
if ($object->fetch($id) > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}

View File

@ -93,7 +93,7 @@ if ($action == 'addcontact' && $user->rights->propale->creer) {
} elseif ($action == 'swapstatut' && $user->rights->propale->creer) {
// Toggle the status of a contact
if ($object->id > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
}
} elseif ($action == 'deletecontact' && $user->rights->propale->creer) {
// Deletes a contact

View File

@ -1370,7 +1370,7 @@ if (empty($reshook)) {
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
if ($object->id > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}

View File

@ -75,14 +75,14 @@ if ($action == 'addcontact' && $user->rights->commande->creer) {
} elseif ($action == 'swapstatut' && $user->rights->commande->creer) {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
} elseif ($action == 'deletecontact' && $user->rights->commande->creer) {
// Efface un contact
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -2773,7 +2773,7 @@ if (empty($reshook)) {
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}

View File

@ -82,7 +82,7 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
}
} elseif ($action == 'swapstatut' && $user->rights->facture->creer) {
// Toggle the status of a contact
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $user->rights->facture->creer) {
// Deletes a contact
$result = $object->delete_contact($lineid);

View File

@ -54,6 +54,8 @@ $langs->loadLangs(array("contracts", "orders", "companies", "bills", "products",
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@ -113,7 +115,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) {
$result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
$result = $object->active_line($user, GETPOST('ligne', 'int'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@ -127,7 +129,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
}
if (!$error) {
$result = $object->close_line($user, GETPOST('ligne'), GETPOST('dateend'), urldecode(GETPOST('comment')));
$result = $object->close_line($user, GETPOST('ligne', 'int'), GETPOST('dateend'), urldecode(GETPOST('comment')));
if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
@ -931,10 +933,10 @@ if (empty($reshook)) {
}
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact') {
// Efface un contact
$result = $object->delete_contact(GETPOST('lineid'));
$result = $object->delete_contact(GETPOST('lineid', 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@ -1747,25 +1749,25 @@ if ($action == 'create') {
'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid', 'int'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion);
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}
/*
* Confirmation de la validation activation
*/
if ($action == 'active' && !$_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
if ($action == 'active' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment', 'alpha');
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}
/*
* Confirmation de la validation fermeture
*/
if ($action == 'closeline' && !$_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
if ($action == 'closeline' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment', 'alpha');
@ -1843,8 +1845,8 @@ if ($action == 'create') {
}
// Form to activate line
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.GETPOST('ligne').'&amp;action=active" method="post">';
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.GETPOST('ligne', 'int').'&amp;action=active" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
@ -1893,7 +1895,7 @@ if ($action == 'create') {
print '</form>';
}
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
/**
* Disable a contract line
*/

View File

@ -85,7 +85,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) {
// bascule du statut d'un contact
if ($action == 'swapstatut' && $user->rights->contrat->creer) {
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db, $object->error);
}
@ -94,7 +94,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) {
// Delete contact
if ($action == 'deletecontact' && $user->rights->contrat->creer) {
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -1338,7 +1338,7 @@ abstract class CommonObject
$sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,";
$sql .= " tc.code, tc.libelle";
$sql .= " FROM (".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc)";
$sql .= " WHERE ec.rowid =".$rowid;
$sql .= " WHERE ec.rowid =".((int) $rowid);
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element = '".$this->db->escape($this->element)."'";

View File

@ -110,7 +110,7 @@ if ($action == 'addcontact' && $permission) { // Add a new contact
}
} elseif ($action == 'swapstatut' && $permission) {
// Toggle the status of a contact
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $permission) {
// Deletes a contact
$result = $object->delete_contact($lineid);

View File

@ -96,7 +96,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) {
}
} elseif ($action == 'swapstatut' && $user->rights->expedition->creer) {
// bascule du statut d'un contact
$result = $objectsrc->swapContactStatus(GETPOST('ligne'));
$result = $objectsrc->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $user->rights->expedition->creer) {
// Efface un contact
$result = $objectsrc->delete_contact(GETPOST("lineid"));

View File

@ -1436,10 +1436,10 @@ if (empty($reshook)) {
}
} elseif ($action == 'swapstatut' && $object->id > 0) {
// bascule du statut d'un contact
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $object->id > 0) {
// Efface un contact
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -76,14 +76,14 @@ if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer) {
} elseif ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer) {
// Toggle the status of a contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
} elseif ($action == 'deletecontact' && $user->rights->fournisseur->commande->creer) {
// Deleting a contact
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -1588,14 +1588,14 @@ if (empty($reshook)) {
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
} elseif ($action == 'deletecontact') {
// Efface un contact
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -76,14 +76,14 @@ if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer) {
} elseif ($action == 'swapstatut' && $user->rights->fournisseur->facture->creer) {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
} elseif ($action == 'deletecontact' && $user->rights->fournisseur->facture->creer) {
// Efface un contact
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -107,7 +107,7 @@ if ($action == 'addcontact' && $permission) {
}
} elseif ($action == 'swapstatut' && $permission) {
// Toggle the status of a contact
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $permission) {
// Deletes a contact
$result = $object->delete_contact($lineid);

View File

@ -104,7 +104,7 @@ if ($action == 'addcontact' && $user->rights->projet->creer) {
// bascule du statut d'un contact
if ($action == 'swapstatut' && $user->rights->projet->creer) {
if ($object->fetch($id, $ref)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
@ -113,7 +113,7 @@ if ($action == 'swapstatut' && $user->rights->projet->creer) {
// Efface un contact
if ($action == 'deleteline' && $user->rights->projet->creer) {
$object->fetch($id, $ref);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id.($withproject ? '&withproject=1' : ''));

View File

@ -107,7 +107,7 @@ if ($action == 'addcontact' && $user->rights->reception->creer) {
}
} elseif ($action == 'swapstatut' && $user->rights->reception->creer) {
// bascule du statut d'un contact
$result = $objectsrc->swapContactStatus(GETPOST('ligne'));
$result = $objectsrc->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $user->rights->reception->creer) {
// Efface un contact
$result = $objectsrc->delete_contact(GETPOST("lineid"));

View File

@ -95,14 +95,14 @@ if ($action == 'addcontact' && $user->rights->societe->creer) {
} elseif ($action == 'swapstatut' && $user->rights->societe->creer) {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
} elseif ($action == 'deletecontact' && $user->rights->societe->creer) {
// Efface un contact
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -75,7 +75,7 @@ if ($action == 'addcontact' && $permissiontoedit) {
} elseif ($action == 'swapstatut' && $permissiontoedit) {
// Toggle the status of a contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}