Exemple #1
0
 function ElemRedactB($fld)
 {
     $fld = parent::ElemRedactB($fld);
     $fld['obj_type_id'] = 'room';
     if ($fld['sell'] == '1') {
         $fld['avance'] = $fld['credit'] = '0';
     }
     if (empty($fld['lot_id'])) {
         $max_lot = (int) sql_getValue('SELECT MAX(lot_id) FROM ' . $this->elem_table);
         if ($max_lot) {
             $fld['lot_id'] = $max_lot + 1;
         }
     }
     if (isset($fld['price_rub'])) {
         $fld['price_rub'] = str_replace(array(" ", ","), array("", "."), $fld['price_rub']);
     }
     if (isset($fld['price_metr_rub'])) {
         $fld['price_metr_rub'] = str_replace(array(" ", ","), array("", "."), $fld['price_metr_rub']);
     }
     if (isset($fld['price_rub_print'])) {
         $fld['price_rub_print'] = str_replace(array(" ", ","), array("", "."), $fld['price_rub_print']);
     }
     // Пересчет цены в у.е
     $value = sql_getValue('SELECT value FROM currencies WHERE name="USD"');
     if ($value) {
         $fld['price_dollar'] = $fld['price_rub'] / $value;
     }
     //Проверяем адрес в таблице адресов и координат
     $address = e(strip_tags($fld['address']));
     $address_id = (int) sql_getValue("SELECT id FROM `obj_address` WHERE address='{$address}'");
     if (!$address_id) {
         $address_id = (int) sql_insert('obj_address', array('address' => $address));
     }
     $fld['address_id'] = $address_id;
     //отправка уведомления
     $current_status = sql_getValue("SELECT status FROM `rnt_objects` WHERE id=" . $this->id);
     if ($current_status == 1 && $fld['status'] == 2) {
         SendNotify('ANNOUNCEMENT_PUBLISHED', $fld['client_id'], $fld);
     } else {
         if ($current_status == 2 && $fld['status'] != 2) {
             SendNotify('ANNOUNCEMENT_CLOSED', $fld['client_id'], $fld);
         }
     }
     return $fld;
 }
Exemple #2
0
 function ElemRedactB($fld)
 {
     $fld = parent::ElemRedactB($fld);
     $fld['obj_type_id'] = 'commerce';
     if ($fld['sell'] == '1') {
         $fld['avance'] = $fld['credit'] = '0';
     }
     // Пересчет цены в у.е
     $value = sql_getValue('SELECT value FROM currencies WHERE name="USD"');
     if ($value) {
         $fld['price_dollar'] = $fld['price_rub'] / $value;
     }
     //отправка уведомления
     $current_status = sql_getValue("SELECT status FROM objects WHERE id=" . $this->id);
     if ($current_status == 1 && $fld['status'] == 2) {
         SendNotify('ANNOUNCEMENT_PUBLISHED', $fld['client_id'], $fld);
     } else {
         if ($current_status == 2 && $fld['status'] != 2) {
             SendNotify('ANNOUNCEMENT_CLOSED', $fld['client_id'], $fld);
         }
     }
     return $fld;
 }