Example #1
0
 /**
  * Redéfinition du delete
  *
  * @return void|string
  **/
 function delete()
 {
     if (count($this->_ref_reglements)) {
         return "Vous ne pouvez pas supprimer une facture ayant des règlements";
     }
     if (count($this->_ref_relances)) {
         return "Vous ne pouvez pas supprimer une facture ayant des relances";
     }
     if (CModule::getActive("dPfacturation")) {
         $where = array();
         $where["object_id"] = " = '{$this->_id}'";
         $where["object_class"] = " = '{$this->_class}'";
         $item = new CFactureItem();
         $items = $item->loadList($where);
         foreach ($items as $_item) {
             if ($msg = $_item->delete()) {
                 return $msg;
             }
         }
         $where = array();
         $where["facture_id"] = " = '{$this->_id}'";
         $where["facture_class"] = " = '{$this->_class}'";
         $where[] = "object_class = 'Sejour' OR object_class = 'CConsultation'";
         $liaison = new CFactureLiaison();
         $liaisons = $liaison->loadList($where);
         foreach ($liaisons as $lien) {
             if ($msg = $lien->delete()) {
                 return $msg;
             }
         }
     }
     // Standard delete
     if ($msg = parent::delete()) {
         return $msg;
     }
 }
Example #2
0
<?php

/**
 * $Id: ajax_clean_facture.php 19223 2013-05-21 14:44:04Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage dPfacturation
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19223 $
 */
CCanDo::checkAdmin();
$where = array();
$where["object_class"] = " = 'CConsultation'";
$where["facture_class"] = " = 'CFactureCabinet'";
$group = "object_id HAVING COUNT(object_id) >= 2";
$liaison = new CFactureLiaison();
$liaisons = $liaison->loadList($where, null, null, $group);
foreach ($liaisons as $lien) {
    $fact = $lien->loadRefFacture();
    $fact->loadRefPatient();
    $fact->loadRefPraticien();
    $fact->loadRefsObjects();
    $fact->loadRefsReglements();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("liaisons", $liaisons);
$smarty->display("inc_configure_resolutions.tpl");