Пример #1
0
 /**
  * Redefinition du delete
  * 
  * @return void|string
  **/
 function delete()
 {
     //Supression possible que de la derniere relance d'une facture
     /** @var  CFactureCabinet|CFactureEtablissement $facture*/
     $facture = $this->loadRefFacture();
     $facture->loadRefsRelances();
     if (count($facture->_ref_relances) > 1 && $this->_id != $facture->_ref_last_relance->_id) {
         return "Vous ne pouvez supprimer que la derniere relance emise";
     }
     //Une relance reglee, ne peut pas etre supprimee
     if ($this->etat == "regle") {
         return "La relance est reglee, vous ne pouvez pas la supprimer";
     }
     // Standard store
     if ($msg = parent::delete()) {
         return $msg;
     }
     $facture->loadRefsRelances();
     $facture->_ref_last_relance->etat = "emise";
     $facture->_ref_last_relance->store();
 }
Пример #2
0
 /**
  * @see parent::delete()
  */
 function delete()
 {
     if ($msg = parent::delete()) {
         return $msg;
     }
     if (!$this->_purge) {
         return $this->updateMontant();
     }
     return null;
 }
Пример #3
0
 /**
  * Redéfinition du delete
  * 
  * @return string|null
  */
 function delete()
 {
     // Preload consultation
     $this->load();
     $this->loadRefsFwd();
     // Standard delete
     if ($msg = parent::delete()) {
         return $msg;
     }
     return $this->acquiteFacture();
 }
Пример #4
0
 /**
  * @see parent::delete()
  */
 function delete()
 {
     $items_count = $this->countBackRefs("order_items");
     if ($items_count == 0 || !$this->date_ordered) {
         return parent::delete();
     }
     if ($this->date_ordered && !$this->_received) {
         // TODO: here : cancel order !!
         return parent::delete();
     }
     return "This order cannot be deleted";
 }
Пример #5
0
 /**
  * Custom delete, will delete any link
  *
  * @see parent::delete()
  */
 function delete()
 {
     $ex_object_id = $this->_id;
     $ex_class_id = $this->_ex_class_id;
     if ($msg = parent::delete()) {
         return $msg;
     }
     // Remove CExLinks
     $where = array("ex_class_id" => " = '{$ex_class_id}'", "ex_object_id" => " = '{$ex_object_id}'");
     $ex_link = new CExLink();
     $ex_links = $ex_link->loadList($where);
     foreach ($ex_links as $_ex_link) {
         $_ex_link->delete();
     }
     return null;
 }