public function editRepair($id, $number, $device) { // вносим изменения в склад запчастей $this->id = $id; $this->number = $number; if ($this->spares != '') { $this->spares .= ' '; } if ($this->check_data) { $warehouse = new Application_Model_DbTable_Warehouse(); $warehouse_data = $warehouse->fetchAll(); $warehistory = new Application_Model_DbTable_Warehistory(); foreach ($this->check_data as $id => $value) { $spare_data = $warehouse->getWarehouse($id); $this->spares .= "|| {$spare_data['serial']}-{$spare_data['name']}-{$value}шт "; $row = $warehouse->getWarehouse($id); foreach ($warehouse_data as $rows) { if ($rows['id'] == $id) { $this->remain = $rows['remain']; } } $this->remain -= $value; $this->serial = $row['serial']; $this->name = $row['name']; $this->type = $row['type']; $this->price = 'unload'; $this->path = $row['path']; //имя картинки для запчасти // Вызываем метод модели addMovie для вставки новой записи $warehouse->editWarehouse($id, $this->serial, $this->name, $this->type, $this->remain, $this->price, $this->path); $warehistory->addWarehistory($this->serial, $this->name, "редактирование ремонта -{$this->number}-{$device['name']}", $row['remain'], $value, $this->remain); } } //редактируем запись о ремонте $editRepaire = new Application_Model_DbTable_Repairs(); $editRepaire->editRepaire($this); //сохраняем статус ремонта $devices = new Application_Model_DbTable_Devices(); $devices->editDeviceStatus($this); //сохраняем историю $history = new Application_Model_DbTable_History(); $history->addRepairHistory($this); }