/**
  * Get the properties of our class as strings
  *
  * @return array
  */
 function getProps()
 {
     $props = parent::getProps();
     $props['name'] = 'str notNull';
     $props['link'] = 'uri notNull';
     return $props;
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("handled");
     if (!$this->creation_date) {
         $this->creation_date = CMbDT::dateTime();
         if ($this->_id) {
             $this->creation_date = $this->loadFirstLog()->date;
         }
     }
     if ($this->fieldModified("handled", "1") || $this->handled && !$this->handled_date && !$this->handled_user_id) {
         $this->handled_date = CMbDT::dateTime();
         $this->handled_user_id = CMediusers::get()->_id;
         if ($this->handled) {
             $last_log = $this->loadLastLog();
             $this->handled_date = $last_log->date;
             $this->handled_user_id = $last_log->user_id;
         }
     }
     if ($this->fieldModified("handled", "0")) {
         $this->handled_date = $this->handled_user_id = "";
     }
     if ($msg = parent::store()) {
         return $msg;
     }
 }
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_shortview = $this->_view = $this->nom;
     $this->_width_etiq = round(($this->largeur_page - 2 * $this->marge_horiz) / $this->nb_colonnes, 2);
     $this->_height_etiq = round(($this->hauteur_page - 2 * $this->marge_vert) / $this->nb_lignes, 2);
 }
 /**
  * @see parent::loadRefsFwd()
  */
 function loadRefsFwd()
 {
     parent::loadRefsFwd();
     $this->_ref_user = new CMediusers();
     $this->_ref_user->load($this->user_id);
     $this->_view = "Note écrite par " . $this->_ref_user->_view;
 }
 /**
  * Get the properties of our class as strings
  *
  * @return array
  */
 function getProps()
 {
     $props = parent::getProps();
     $props["object_id"] = "ref notNull class|CMbObject meta|object_class cascade";
     $props["submissionlot_id"] = "ref class|CXDSSubmissionLot";
     $props["object_class"] = "enum list|CCompteRendu|CFile notNull";
     return $props;
 }
 /**
  * @see parent::getProps()
  */
 function getProps()
 {
     $specs = parent::getProps();
     $specs["object_id"] = "ref notNull class|CFacture meta|object_class";
     $specs["object_class"] = "enum notNull list|CFactureCabinet|CFactureEtablissement show|0 default|CFactureCabinet";
     $specs["journal_id"] = "ref notNull class|CJournalBill autocomplete|nom";
     return $specs;
 }
 /**
  * Get the properties of our class as strings
  *
  * @return array
  */
 function getProps()
 {
     $props = parent::getProps();
     $props["user_id"] = "ref class|CMediusers notNull";
     $props["datetime"] = "dateTime notNull";
     $props["group_id"] = "ref class|CGroups notNull";
     return $props;
 }
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_value = $this->value;
     if (array_key_exists($this->type, self::$_style_values)) {
         $this->_value = CAppUI::tr("{$this->_class}.value.{$this->type}.{$this->value}");
     }
     $this->_view = $this->getFormattedValue("type") . ": {$this->value}";
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     // Standard store
     if ($msg = parent::store()) {
         return $msg;
     }
     $this->loadRefFacture();
     return null;
 }
Beispiel #10
0
 /**
  * Load object
  *
  * @return CMbObject|CMediusers
  */
 function loadRefMetaObject()
 {
     $this->_ref_metaobject = CMbMetaObject::loadFromGuid("{$this->object_class}-{$this->object_id}");
     if ($this->object_class == "CMediusers") {
         $this->_ref_mediuser = $this->_ref_metaobject;
         $this->_ref_mediuser->loadRefFunction();
     }
     return $this->_ref_metaobject;
 }
 /**
  * @see parent::getProps
  */
 function getProps()
 {
     $props = parent::getProps();
     $props["function_id"] = "ref class|CFunctions notNull";
     $props["object_id"] = "ref notNull class|CSourcePrinter meta|object_class";
     $props["object_class"] = "str notNull class show|0";
     $props["label"] = "str";
     return $props;
 }
Beispiel #12
0
 /**
  * @see parent::getProps()
  */
 function getProps()
 {
     $props = parent::getProps();
     $props["object_class"] = "enum notNull list|CFactureCabinet|CFactureEtablissement default|CFactureCabinet";
     $props["date"] = "date notNull";
     $props["montant"] = "currency notNull decimals|2";
     $props["description"] = "text";
     return $props;
 }
 /**
  * @see parent::getProps()
  */
 function getProps()
 {
     $specs = parent::getProps();
     $specs["compte_rendu_id"] = "ref class|CCompteRendu notNull cascade";
     $specs["object_class"] = "enum list|CMedecin|CPatient|CCorrespondantPatient notNull";
     $specs["quantite"] = "num pos notNull min|1 default|1";
     $specs["tag"] = "str";
     return $specs;
 }
Beispiel #14
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     $this->completeField("tag_id", "object_class");
     if ($this->loadRefTag()->object_class !== $this->object_class) {
         return "L'objet et le tag doivent appartenir à la même classe";
     }
     return null;
 }
 /**
  * @see parent::getProps
  */
 function getProps()
 {
     $props = parent::getProps();
     $props["object_id"] = "ref notNull class|CInteropActor meta|object_class cascade";
     $props["object_class"] = "str notNull show|0";
     $props["message"] = "str notNull";
     $props["active"] = "bool default|0";
     $props["profil"] = "str";
     $props["transaction"] = "str";
     return $props;
 }
 /**
  * @see parent::getProps()
  */
 function getProps()
 {
     $props = parent::getProps();
     $props["feature"] = "str notNull";
     $props["value"] = "str";
     $props["object_id"] = "ref class|CMbObject meta|object_class";
     // not notNull
     $props["object_class"] = "str class show|0";
     // not notNull
     return $props;
 }
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     parent::updatePlainFields();
     if ($this->_type) {
         list($this->object_class, $this->object_id) = explode("-", $this->_type);
         $this->_type = null;
     }
     if ($this->_before && $this->_before != $this->_id) {
         $next_object = new self();
         $next_object->load($this->_before);
         if ($next_object->_id) {
             $query = '';
             $table = $this->_spec->table;
             if ($this->position) {
                 $query = "AND `{$table}`.`position` BETWEEN {$next_object->position} AND {$this->position}";
             } else {
                 if ($next_object->position) {
                     $query = "AND `{$table}`.`position` >= {$next_object->position}";
                 }
             }
             $where = array("`{$table}`.`position` IS NOT NULL {$query}", "`{$table}`.`object_class` = '{$this->object_class}'", "`{$table}`.`object_id` = '{$this->object_id}'");
             $this->position = $next_object->position;
             /** @var self[] $next_objects */
             $next_objects = $this->loadList($where);
             foreach ($next_objects as &$object) {
                 $object->position++;
                 $object->store();
             }
             if (count($next_objects) == 0) {
                 $next_object->position = 2;
                 $next_object->store();
                 $this->position = 1;
             }
         }
         $this->_before = null;
     } else {
         if (!$this->_id && !$this->position) {
             $existing = $this->loadList(null, "position");
             if ($location = end($existing)) {
                 $this->position = $location->position + 1;
             } else {
                 $this->position = 1;
             }
         }
     }
 }
Beispiel #18
0
 /**
  * @see parent::loadTargetObject
  */
 function loadTargetObject($cache = true)
 {
     $object = parent::loadTargetObject($cache);
     /** @var $object CSourcePrinter */
     $this->_view = $object->_view;
 }
Beispiel #19
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();
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     $uf = $this->loadRefUniteFonctionnelle();
     if (count($this->getAffDates($this->loadTargetObject(), $uf->type, $uf->date_debut, $uf->date_fin))) {
         return "Collision d'affection d'unité foncitonnelle";
     }
     return parent::store();
 }
Beispiel #21
0
 /**
  * @see parent::delete()
  */
 function delete()
 {
     if ($msg = parent::delete()) {
         return $msg;
     }
     if (!$this->_purge) {
         return $this->updateMontant();
     }
     return null;
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("codes_cim");
     $this->_codes_cim = $this->codes_cim ? explode("|", $this->codes_cim) : array();
     if ($this->_added_code_cim) {
         $da = CCodeCIM10::get($this->_added_code_cim);
         if (!$da->exist) {
             CAppUI::setMsg("Le code CIM saisi n'est pas valide", UI_MSG_WARNING);
             return null;
         }
         $this->_codes_cim[] = $this->_added_code_cim;
     }
     if ($this->_deleted_code_cim) {
         CMbArray::removeValue($this->_deleted_code_cim, $this->_codes_cim);
     }
     $this->codes_cim = implode("|", array_unique($this->_codes_cim));
     $this->completeField("object_id", "object_class");
     if ($this->object_class == "CPatient" && $this->fieldModified("codes_cim")) {
         DSHM::remKeys("alertes-*-CPatient-" . $this->object_id);
     }
     return parent::store();
 }
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_montant_facture = $this->montant_base + $this->montant_depassement;
     $this->_view = $this->libelle;
     if ($this->type == "CActeNGAP") {
         $this->_montant_total_base = $this->montant_base;
         $this->_montant_total_depassement = $this->montant_depassement;
     } else {
         $this->_montant_total_base = $this->montant_base * $this->quantite * $this->coeff;
         $this->_montant_total_depassement = $this->montant_depassement * $this->quantite * $this->coeff;
     }
 }
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->loadRefsFwd();
     $this->_view = $this->_ref_object->_view . " ({$this->quantity})";
 }
Beispiel #25
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_view = "[{$this->starting_formula} => {$this->closing_formula}]";
 }
 /**
  * @see parent::getPerm()
  */
 function getPerm($permType)
 {
     $this->loadRefAuthor();
     $this->loadRefCategory();
     // Permission de base
     $perm = parent::getPerm($permType);
     // Il faut au moins avoir le droit de lecture sur la catégories
     if ($this->file_category_id) {
         $perm &= $this->_ref_category->getPerm(PERM_READ);
     }
     // Gestion d'un document confidentiel
     if ($this->private) {
         $sameFunction = $this->_ref_author->function_id == CMediusers::get()->function_id;
         $isAdmin = CMediusers::get()->isAdmin();
         $perm &= $sameFunction || $isAdmin;
     }
     return $perm;
 }
Beispiel #27
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if (!$this->_id) {
         $this->datetime_create = "now";
     }
     if (!$this->_id && !$this->last_update) {
         $this->last_update = "now";
     }
     return parent::store();
 }
 /**
  * @see parent::loadView()
  */
 function loadView()
 {
     parent::loadView();
     foreach ($this->_ref_order_items as $_item) {
         if ($_item->lot_id) {
             $_item->loadRefLot();
             $this->_has_lot_numbers = true;
         }
     }
 }
 /**
  * Création d'une instance de la classe
  *
  * @param String $id String
  */
 function __construct($id)
 {
     parent::__construct();
     $this->id = $id;
     $this->_group_id = CGroups::loadCurrent()->_id;
 }
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->loadRefs();
     switch ($this->object_class) {
         case "CPlageOp":
             $this->_debut = CMbDT::addDateTime($this->_ref_object->debut, $this->_ref_object->date);
             $this->_debut_dt = CMbDT::addDateTime($this->_ref_object->debut, $this->_ref_object->date);
             $this->_fin = CMbDT::addDateTime($this->_ref_object->fin, $this->_ref_object->date);
             $this->_fin_dt = CMbDT::addDateTime($this->_ref_object->fin, $this->_ref_object->date);
             break;
         case "COperation":
         case "CBloodSalvage":
             if ($this->debut) {
                 $this->_debut = CMbDT::time($this->debut);
                 $this->_debut_dt = $this->debut;
             }
             if ($this->fin) {
                 $this->_fin = CMbDT::time($this->fin);
                 $this->_fin_dt = $this->fin;
             }
     }
 }