Jump to content

Edit History

Allyta

Allyta


Correction bêtise

Merci pour ta réponse 😃 
Mon model Reception est le suivant

<?php
/* 
Classe Reception.
Réalisé par : Allyta
*/
class Reception extends ObjectModel{
  public $id;
  public $id_reception; 
  public $id_ingredient;
  public $id_fournisseur;
  public $date_reception;
  public $ingredient_quantite_reception;
  public $id_unite;
  public $num_lot_fournisseur_reception;
  public $ddm_fournisseur_reception;
  public $num_lot_reception;
  public $ddm_reception;
  public $transporteur_reception;
  public $prix_ingredient_kg_reception;
  public $quantite_conforme_reception;
  public $integrite_reception;
  public $visa_reception;

  /**
   * @see ObjectModel::$definition
   */
  public static $definition = array(
    'table' => 'gp_reception',
    'primary' => 'id_reception',
    'multilang' => 'false',
    'fields' => array(
      'date_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'required' => true, 'size' =>255),
      'ingredient_quantite_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'num_lot_fournisseur_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'ddm_fournisseur_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'size' =>255),
      'num_lot_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'ddm_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'size' =>255),
      'transporteur_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'prix_ingredient_kg_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'quantite_conforme_reception' => array('type'=>self::TYPE_BOOL, 'validate'=> 'isAnything', 'required' => true, 'size' =>1),
      'integrite_reception' => array('type'=>self::TYPE_BOOL, 'validate'=> 'isAnything', 'required' => true, 'size' =>1),
      'visa_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
    )
  );

  /**
  * Reception constructor.
  * @param null $id
  */
  public function __construct($id = null)
  {
    parent::__construct($id);
  }

  /**
   * Return receptions.
   *
   * @return array Receptions
   */
  public static function getReceptions()
  {
    $query = new DbQuery();
    $query->select('s.*');
    $query->from('gp_reception', 's');
    $query->join(Shop::addSqlAssociation('reception', 's'));
    $query->orderBy(' s.`date_recetpion` DESC');
    $query->groupBy('s.id_reception');

    $receptions = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
    if ($receptions === false) {
      return false;
    }
    return $receptions;
  }

  /**
  * Delete reception
  */
  public function delete()
  {
    Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'gp_reception` WHERE `id_reception`=' . (int) $this->id);
    return false;
  }
}

 

Allyta

Allyta


Correction bêtise

Merci pour ta réponse 😃 
Mon model Reception est le suivant

<?php
/* 
Classe Reception.
Réalisé par : Allyta
*/
class Reception extends ObjectModel{
  public $id;
  public $id_reception; 
  public $id_ingredient;
  public $id_fournisseur;
  public $date_reception;
  public $ingredient_quantite_reception;
  public $id_unite;
  public $num_lot_fournisseur_reception;
  public $ddm_fournisseur_reception;
  public $num_lot_reception;
  public $ddm_reception;
  public $transporteur_reception;
  public $prix_ingredient_kg_reception;
  public $quantite_conforme_reception;
  public $integrite_reception;
  public $visa_reception;

  /**
   * @see ObjectModel::$definition
   */
  public static $definition = array(
    'table' => 'gp_reception',
    'primary' => 'id_reception',
    'multilang' => 'false',
    'fields' => array(
      'date_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'required' => true, 'size' =>255),
      'ingredient_quantite_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'num_lot_fournisseur_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'ddm_fournisseur_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'size' =>255),
      'num_lot_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'ddm_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'size' =>255),
      'transporteur_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'prix_ingredient_kg_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'quantite_conforme_reception' => array('type'=>self::TYPE_BOOL, 'validate'=> 'isAnything', 'required' => true, 'size' =>1),
      'integrite_reception' => array('type'=>self::TYPE_BOOL, 'validate'=> 'isAnything', 'required' => true, 'size' =>1),
      'visa_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
    )
  );

  /**
  * Reception constructor.
  * @param null $id
  */
  public function __construct($id = null)
  {
    parent::__construct($id);
  }

  /**
   * Return receptions.
   *
   * @return array Receptions
   */
  public static function getReceptions()
  {
    $query = new DbQuery();
    $query->select('s.*');
    $query->from('gp_reception', 's');
    $query->join(Shop::addSqlAssociation('reception', 's'));
    $query->orderBy(' s.`date_recetpion` DESC');
    $query->groupBy('s.id_reception');

    $receptions = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
    if ($receptions === false) {
      return false;
    }
    return $receptions;
  }

  /**
  * Delete reception
  */
  /**
  * Delete reception
  */
  public function delete()
  {
    Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'gp_reception` WHERE `id_reception`=' . (int) $this->id);
    return false;
  }
}

 

Allyta

Allyta

Merci pour ta réponse 😃 
Mon model Reception est le suivant

<?php
/* 
Classe Reception.
Réalisé par : Allyta
*/
class Reception extends ObjectModel{
  public $id;
  public $id_reception; 
  public $id_ingredient;
  public $id_fournisseur;
  public $date_reception;
  public $ingredient_quantite_reception;
  public $id_unite;
  public $num_lot_fournisseur_reception;
  public $ddm_fournisseur_reception;
  public $num_lot_reception;
  public $ddm_reception;
  public $transporteur_reception;
  public $prix_ingredient_kg_reception;
  public $quantite_conforme_reception;
  public $integrite_reception;
  public $visa_reception;

  /**
   * @see ObjectModel::$definition
   */
  public static $definition = array(
    'table' => 'gp_reception',
    'primary' => 'id_reception',
    'multilang' => 'false',
    'fields' => array(
      'date_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'required' => true, 'size' =>255),
      'ingredient_quantite_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'num_lot_fournisseur_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'ddm_fournisseur_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'size' =>255),
      'num_lot_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'ddm_reception' => array('type'=>self::TYPE_DATE, 'validate'=> 'isDate', 'size' =>255),
      'transporteur_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'prix_ingredient_kg_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
      'quantite_conforme_reception' => array('type'=>self::TYPE_BOOL, 'validate'=> 'isAnything', 'required' => true, 'size' =>1),
      'integrite_reception' => array('type'=>self::TYPE_BOOL, 'validate'=> 'isAnything', 'required' => true, 'size' =>1),
      'visa_reception' => array('type'=>self::TYPE_STRING, 'validate'=> 'isAnything', 'required' => true, 'size' =>255),
    )
  );

  /**
  * Reception constructor.
  * @param null $id
  */
  public function __construct($id = null)
  {
    parent::__construct($id);
  }

  /**
   * Return receptions.
   *
   * @return array Receptions
   */
  public static function getReceptions()
  {
    $query = new DbQuery();
    $query->select('s.*');
    $query->from('gp_reception', 's');
    $query->join(Shop::addSqlAssociation('reception', 's'));
    $query->orderBy(' s.`date_recetpion` DESC');
    $query->groupBy('s.id_reception');

    $receptions = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
    if ($receptions === false) {
      return false;
    }
    return $receptions;
  }

  /**
  * Delete reception
  */
  public function delete($id)
  {
    Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'gp_reception` WHERE `id_reception`=' $id;
    return false;
  }

 

×
×
  • Create New...