69 lines
1.3 KiB
PHP
69 lines
1.3 KiB
PHP
<?php
|
|
|
|
include_once( realpath( dirname( __FILE__ ) ) . "/../../../../fonctions/authplugins.php" );
|
|
|
|
autorisation("colissimoexpert");
|
|
|
|
$id = lireParam( 'id' , 'int' , 'POST' );
|
|
$poidsMax = lireParam( 'poidsmax' , 'float' , 'POST' );
|
|
$tarif = lireParam( 'tarif' , 'float' , 'POST' );
|
|
$zone = lireParam( 'zone' , 'int' , 'POST' );
|
|
|
|
// Poids dans l'intervale autorisé
|
|
$actionValide = true;
|
|
if ( $poidsMax < 0 ) {
|
|
|
|
$actionValide = false;
|
|
$messages[] = array(
|
|
'classe' => 'erreur' ,
|
|
'message' => "Le poids doit être positif."
|
|
);
|
|
}
|
|
|
|
// Poids sans doublon
|
|
if ( $actionValide ) {
|
|
|
|
$tmpObjTarif = new Tarifcolissimoexpert();
|
|
$tmpObjTarif->chargerPoids( $poidsMax , $zone );
|
|
|
|
if ( $tmpObjTarif->id ) {
|
|
|
|
if ( $tmpObjTarif->id != $id ) {
|
|
|
|
$actionValide = false;
|
|
$messages[] = array(
|
|
'classe' => 'erreur' ,
|
|
'message' => "Ce poids est déjà saisi."
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Edition
|
|
if ( $actionValide ) {
|
|
|
|
$sql = "
|
|
UPDATE
|
|
tarifcolissimoexpert
|
|
SET
|
|
poidsmax = " . $poidsMax . " ,
|
|
tarif = " . $tarif . " ,
|
|
zone = " . $zone . "
|
|
WHERE
|
|
id = " . $id . "
|
|
";
|
|
|
|
$cnx = new Cnx();
|
|
|
|
$resultat = mysql_query( $sql , $cnx->link );
|
|
|
|
if ( $resultat ) {
|
|
|
|
$messages[] = array(
|
|
'classe' => 'valide' ,
|
|
'message' => "Mise à jour réalisée avec succès."
|
|
);
|
|
}
|
|
}
|
|
|
|
|