Skip to content

Commit

Permalink
correction de petits bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2choiz committed Apr 19, 2015
1 parent fb789d9 commit 79fbc33
Show file tree
Hide file tree
Showing 11 changed files with 7,191 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Application/Controllers/Commentaire.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function updateCommentaire($params) { //ajouter un commentaire

$modelCommentaire = new \Application\Models\Commentaire();

if($modelCommentaire->update(" `id_commentaire`='{$params['id_commentaire']}' ", $params) ) {
if($modelCommentaire->update(" `id_com`='{$params['id_com']}' ", $params) ) {
return $this->setApiResult(true);
}else{
return $this->setApiResult(false, true, "erreur pendant la mise a jour");
Expand Down Expand Up @@ -139,7 +139,7 @@ public function deleteCommentaire($params) { //delete une commentaire
$modelComm = new \Application\Models\Commentaire();


if($modelLI->delete(" `id_commentaire`='{$params['id_commentaire']}' ") ) {
if($modelComm->delete(" `id_com`='{$params['id_com']}' ") ) {
return $this->setApiResult(true);
}else{
return $this->setApiResult(false, true, "erreur pendant la suppression du commentaire");
Expand Down
2 changes: 1 addition & 1 deletion Application/Controllers/Ingredient.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function insertIngredients($params) {
if( $res ) {
return $this->setApiResult($modelIngredient->getLast());
}else{
return $this->setApiResult(false, true, "erreur pendant l'insertion des ingredients");
return $this->setApiResult(false, true, "erreur pendant l'insertion de l'ingredient");
}


Expand Down
15 changes: 12 additions & 3 deletions Application/Controllers/ListIngredients.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ public function insertListIngredients($params) {
unset($params['method']);
$modelLI = new \Application\Models\ListIngredients();

//var_dump($params);
if (empty($params['ingredients']) || empty($params['unites']) || empty($params['quantites']) ) {
return $this->setApiResult(false, true, "les données concernant les ingrédients n'ont pas étées recu");
}

$params['ingredients']=json_decode($params['ingredients']) ;
$params['unites']=json_decode($params['unites']) ;
$params['quantites']=json_decode($params['quantites']) ;

$res=$modelLI->insertListIngredients($params);



if($res ) {
return $this->setApiResult( $res );
Expand All @@ -47,14 +52,18 @@ public function updateListIngredients($params) {
unset($params['method']);
$modelLI = new \Application\Models\ListIngredients();

var_dump($params);

if (empty($params['ingredients']) || empty($params['unites']) || empty($params['quantites']) ) {
return $this->setApiResult(false, true, "les données concernant les ingrédients n'ont pas étées recu");
}

//supression de tout les ingredients de la recette
$modelLI->delete(" `id_recette`={$params['id_recette']} ");




//var_dump($params);

$params['ingredients']=json_decode($params['ingredients']) ;
$params['unites']=json_decode($params['unites']) ;
$params['quantites']=json_decode($params['quantites']) ;
Expand Down
4 changes: 2 additions & 2 deletions Application/Controllers/ListProduit.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ public function insertListProduit($params) {


/**
* Méthode post($params)
* Méthode deleteListProduit($params)
*
* Crée une recette avec les paramètres de la requête POST
*
* @param array $params [données de requête]
* @return array
*
*/
public function deleteListProduit($params) { //delete une recette
public function deleteListProduit($params) {


unset($params['method']);
Expand Down
5 changes: 3 additions & 2 deletions Application/Controllers/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public function updateNote($params) {

$modelNote = new \Application\Models\Note();
$res=$modelNote->fetchAll(" `id_user`={$params['id_user']} AND `id_recette`={$params['id_recette']} ");
//var_dump($res);
if (empty($res) ) { //si la note pour la recette n'existe pas

//si la note pour la recette n'existe pas
if (empty($res) ) {
$res=$modelNote->insert($params);
$res=($res>0)?true:false;
} else {
Expand Down
19 changes: 5 additions & 14 deletions Application/Controllers/Panier.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public function deletePanier($params) {
unset($params['method']);

$modelPanier = new \Application\Models\Panier();
//echo " `id_produit`='{$params['id_produit']}' AND `id_user`='{$params['id_user']}' ";
$res = $modelPanier->delete(" `id_panier`='{$params['id_panier']}' AND `id_user`='{$params['id_user']}' ");
//var_dump($res);

$res = $modelPanier->delete(" `id_panier`='{$params['id_panier']}' ");

if( $res ) {
return $this->setApiResult(true);
}else{
Expand Down Expand Up @@ -140,9 +140,7 @@ public function getHtmlIconPanier($params) {

if( !empty( $res ) ) {
$nbrProd=count($res);
$html="
$nbrProd
";
$html="$nbrProd";

return $this->setApiResult( $html);
}else{
Expand Down Expand Up @@ -190,19 +188,12 @@ public function getSommePanier($params) {
$Viewpanier=$modelViewPanier->fetchAll(" `id_user`='{$params['id_user']}'");

$somme=0;
foreach ($Viewpanier as $key => $produit) {
foreach ($Viewpanier as $produit) {
$somme+=$produit->prix_produit;
}

return $this->setApiResult( $somme);

/*if( !empty( $res ) ) {
return $this->setApiResult( $res);
}else{
return $this->setApiResult(null);
}*/


}


Expand Down
4 changes: 3 additions & 1 deletion Application/Controllers/Produit.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ public function updateProduit($params) {

unset($params['method']);

$params['prix']=$params['prix']+0;
if(!empty($params['prix'])){
$params['prix']=$params['prix']+0;
}
//var_dump();
$modelProduit = new \Application\Models\Produit();

Expand Down
4 changes: 2 additions & 2 deletions Application/Controllers/QuestionSecrete.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function updateQuestionSecrete($params) {

$modelQuestionSecrete = new \Application\Models\QuestionSecrete();

$res=$modelQuestionSecrete->update(" `id_cat`='{$params['id_cat']}'", $params);
$res=$modelQuestionSecrete->update(" `id_questionsecrete`='{$params['id_questionsecrete']}'", $params);

if( $res ) {
return $this->setApiResult(true);
Expand All @@ -117,7 +117,7 @@ public function deleteQuestionSecrete($params) {

$modelQuestionSecrete = new \Application\Models\QuestionSecrete();

$res=$modelQuestionSecrete->delete("`id_cat`='{$params['id_cat']}'");
$res=$modelQuestionSecrete->delete("`id_questionsecrete`='{$params['id_questionsecrete']}'");

if( $res ) {
return $this->setApiResult(true);
Expand Down
Loading

0 comments on commit 79fbc33

Please sign in to comment.