コード例 #1
0
 function process_record_hook(&$bean, $event, $arguments)
 {
     $bean->d8754_assetnumber_notice_c = '';
     $full_copy = new d8754_AssetNumber();
     $full_copy->retrieve($bean->id);
     $linked_rentalitems = $full_copy->get_linked_beans('d8754_assetnumber_d8753_rentalitem_1', 'd8753_rentalitem');
     if (count($linked_rentalitems) >= 1) {
         foreach ($linked_rentalitems as $ri) {
             $projnames = '';
             $riproj = $ri->get_linked_beans('d8753_rentalitem_project', 'Project');
             if (count($riproj) >= 1) {
                 foreach ($riproj as $lproj) {
                     $projnames .= $lproj->name . ",";
                 }
                 $projnames = substr($projnames, 0, -1);
             }
             if ($ri->status == "Pending") {
                 $bean->d8754_assetnumber_notice_c .= '&nbsp;<span title="Pending to rental items on job ' . $projnames . '" style="color:#E6E600;">&#x2691;</span>';
             }
             if ($ri->status == "Active") {
                 $bean->d8754_assetnumber_notice_c .= '&nbsp;<span title="Active on rental items on job ' . $projnames . '" style="color:#FF0000;">&#x26D4;</span>';
             }
         }
     }
 }
コード例 #2
0
ファイル: view.edit.php プロジェクト: aldridged/airtap-sugar
 function display()
 {
     $this->ev->process();
     echo "<!-- \n";
     //echo "REQUEST\n";
     //var_dump($_REQUEST);
     echo "\nFIELD DEFS\n";
     var_dump($this->ev->fieldDefs);
     echo "-->";
     if (!empty($this->ev->fieldDefs['d8754_assetnumber_d8753_rentalitem_1d8754_assetnumber_ida']['value'])) {
         $asset_number = new d8754_AssetNumber();
         $asset_type = new d8754_AssetType();
         $asset_number->retrieve($this->ev->fieldDefs['d8754_assetnumber_d8753_rentalitem_1d8754_assetnumber_ida']['value']);
         $linked_types = $asset_number->get_linked_beans('d8754_assettype_d8754_assetnumber', 'd8754_AssetType');
         foreach ($linked_types as $cur_type) {
             $asset_type = $cur_type;
         }
         $this->ev->fieldDefs['d8754_assettype_d8753_rentalitem_1d8754_assettype_ida']['value'] = $asset_type->id;
         $this->ev->fieldDefs['d8754_assettype_d8753_rentalitem_1_name']['value'] = $asset_type->name;
     }
     echo $this->ev->display();
 }