Пример #1
0
 public function getNewMessages($id_shop = null)
 {
     $soap_client = self::getSoapClient();
     $result = $soap_client->getNewMessages($this->getAuth($id_shop));
     $transaction_id = $result->transactionId;
     foreach ($result->messages as $message) {
         $claim = MediafinanzClaim::getInstanceByFilenumber($message->fileNumber);
         if (Validate::isLoadedObject($claim)) {
             $new_message = new MediafinanzNewMessage();
             $new_message->id_order = $claim->id_order;
             $new_message->id_shop = $claim->id_shop;
             $new_message->file_number = (int) $message->fileNumber;
             $new_message->invoice_number = (int) $message->invoiceNumber;
             $new_message->text = $message->text;
             $new_message->time = date('Y-m-d H:i:s', strtotime($message->time));
             $new_message->add();
         }
     }
     Configuration::updateValue('MEDIAFINANZ_LASTMESSAGEUPDATE', date('Y-m-d H:i:s'), false, null, $id_shop);
     if ($soap_client->commitTransaction($this->getAuth($id_shop), $transaction_id)) {
         return true;
     }
 }
 public function renderView()
 {
     if (Tools::getValue('id_mf_new_message')) {
         $mf_message = new MediafinanzNewMessage((int) Tools::getValue('id_mf_new_message'));
         if (Validate::isLoadedObject($mf_message)) {
             $claim_object = MediafinanzClaim::getMediafinanzClaimByOrderId($mf_message->id_order);
         } else {
             $claim_object = new MediafinanzClaim();
         }
     } else {
         $claim_object = new MediafinanzClaim(Tools::getValue('id_mf_claim'));
     }
     if (!Validate::isLoadedObject($claim_object)) {
         $this->errors[] = $this->l('The claim cannot be found within your database.');
     }
     try {
         $claim_details = $this->module->getClaimDetails($claim_object);
         $claim_history = $this->module->getClaimHistory($claim_object->file_number);
         $claim_message_history = $this->module->getMessageHistory($claim_object->file_number);
         $claim_options = $this->module->getClaimOptions($claim_object->file_number);
     } catch (Exception $e) {
         $this->errors[] = $e->getMessage();
         Mediafinanz::logToFile($e->getMessage(), 'general');
     }
     if (in_array('close', $claim_options)) {
         $claim_options[] = 'bookDirectPayment';
     }
     // add form for direct payment
     //remove actions from this version of module
     $remove_options = array('lawyer', 'factoring', 'longTermObservation', 'addressIdentification');
     $claim_options = array_values(array_diff($claim_options, $remove_options));
     $this->context->smarty->assign('claim_details', $claim_details);
     $this->context->smarty->assign('claim_history', $claim_history);
     $this->context->smarty->assign('claim_options', $claim_options);
     $this->context->smarty->assign('claim_message_history', $claim_message_history);
     $this->context->smarty->assign('instructions_for_assigning', $this->module->getInstructionsForAssigningClaimToLawyer());
     $this->context->smarty->assign('mission_depthes', $this->module->getMissionDepthes());
     $this->setTemplate('claim-view' . (_PS_VERSION_ < '1.6.0.0' ? '_15' : '') . '.tpl');
 }