当前位置: 首页>>代码示例>>PHP>>正文


PHP AccountLine::delete_urls方法代码示例

本文整理汇总了PHP中AccountLine::delete_urls方法的典型用法代码示例。如果您正苦于以下问题:PHP AccountLine::delete_urls方法的具体用法?PHP AccountLine::delete_urls怎么用?PHP AccountLine::delete_urls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AccountLine的用法示例。


在下文中一共展示了AccountLine::delete_urls方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  *      Delete a social contribution
  *
  *      @param		User    $user   Object user making delete
  *      @return     		int 	<0 if KO, >0 if OK
  */
 function delete($user)
 {
     $error = 0;
     $this->db->begin();
     // Get bank transaction lines for this social contributions
     include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
     $account = new Account($this->db);
     $lines_url = $account->get_url('', $this->id, 'sc');
     // Delete bank urls
     foreach ($lines_url as $line_url) {
         if (!$error) {
             $accountline = new AccountLine($this->db);
             $accountline->fetch($line_url['fk_bank']);
             $result = $accountline->delete_urls($user);
             if ($result < 0) {
                 $error++;
             }
         }
     }
     // Delete payments
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "paiementcharge where fk_charge='" . $this->id . "'";
         dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
         $resql = $this->db->query($sql);
         if (!$resql) {
             $error++;
             $this->error = $this->db->lasterror();
         }
     }
     if (!$error) {
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "chargesociales where rowid='" . $this->id . "'";
         dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
         $resql = $this->db->query($sql);
         if (!$resql) {
             $error++;
             $this->error = $this->db->lasterror();
         }
     }
     if (!$error) {
         $this->db->commit();
         return 1;
     } else {
         $this->db->rollback();
         return -1;
     }
 }
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:52,代码来源:chargesociales.class.php

示例2: delete

 /**
  *      Supprime un paiement ainsi que les lignes qu'il a genere dans comptes
  *      Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
  *      Si le paiement porte sur au moins une facture a "payee", on refuse
  *
  *      @param	int		$notrigger		No trigger
  *      @return int     				<0 si ko, >0 si ok
  */
 function delete($notrigger = 0)
 {
     global $conf, $user, $langs;
     $error = 0;
     $bank_line_id = $this->bank_line;
     $this->db->begin();
     // Verifier si paiement porte pas sur une facture classee
     // Si c'est le cas, on refuse la suppression
     $billsarray = $this->getBillsArray('fk_statut > 1');
     if (is_array($billsarray)) {
         if (count($billsarray)) {
             $this->error = "ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible";
             $this->db->rollback();
             return -1;
         }
     } else {
         $this->db->rollback();
         return -2;
     }
     $accline = new AccountLine($this->db);
     // Delete bank urls. If payment is on a conciliated line, return error.
     if ($bank_line_id) {
         $result = $accline->fetch($bank_line_id);
         if ($result == 0) {
             $accline->rowid = $bank_line_id;
         }
         // If not found, we set artificially rowid to allow delete of llx_bank_url
         $result = $accline->delete_urls($user);
         if ($result < 0) {
             $this->error = $accline->error;
             $this->db->rollback();
             return -3;
         }
     }
     // Delete payment (into paiement_facture and paiement)
     $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'paiement_facture';
     $sql .= ' WHERE fk_paiement = ' . $this->id;
     dol_syslog($sql);
     $result = $this->db->query($sql);
     if ($result) {
         $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'paiement';
         $sql .= ' WHERE rowid = ' . $this->id;
         dol_syslog($sql);
         $result = $this->db->query($sql);
         if (!$result) {
             $this->error = $this->db->lasterror();
             $this->db->rollback();
             return -3;
         }
         // Supprimer l'ecriture bancaire si paiement lie a ecriture
         if ($bank_line_id) {
             $result = $accline->delete($user);
             if ($result < 0) {
                 $this->error = $accline->error;
                 $this->db->rollback();
                 return -4;
             }
         }
         if (!$notrigger) {
             // Appel des triggers
             $result = $this->call_trigger('PAYMENT_DELETE', $user);
             if ($result < 0) {
                 $this->db->rollback();
                 return -1;
             }
             // Fin appel triggers
         }
         $this->db->commit();
         return 1;
     } else {
         $this->error = $this->db->error;
         $this->db->rollback();
         return -5;
     }
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:83,代码来源:paiement.class.php

示例3: delete

	/**
	 *      Supprime un paiement ainsi que les lignes qu'il a genere dans comptes
	 *      Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
	 *      Si le paiement porte sur au moins une facture a "payee", on refuse
	 *      @return     int     <0 si ko, >0 si ok
	 */
	function delete($notrigger=0)
	{
		global $conf, $user, $langs;

		$error=0;

		$bank_line_id = $this->bank_line;

		$this->db->begin();

		// Verifier si paiement porte pas sur une facture classee
		// Si c'est le cas, on refuse la suppression
		$billsarray=$this->getBillsArray('fk_statut > 1');
		if (is_array($billsarray))
		{
			if (sizeof($billsarray))
			{
				$this->error="ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible";
				$this->db->rollback();
				return -1;
			}
		}
		else
		{
			$this->db->rollback();
			return -2;
		}

		// Delete bank urls. If payment if on a conciliated line, return error.
		if ($bank_line_id)
		{
			$accline = new AccountLine($this->db);
			$accline->fetch($bank_line_id);
            $result=$accline->delete_urls($user);
            if ($result < 0)
            {
                $this->error=$accline->error;
				$this->db->rollback();
				return -3;
            }
		}

		// Delete payment (into paiement_facture and paiement)
		$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiement_facture';
		$sql.= ' WHERE fk_paiement = '.$this->id;
		$result = $this->db->query($sql);
		if ($result)
		{
			$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiement';
			$sql.= ' WHERE rowid = '.$this->id;
			$result = $this->db->query($sql);
			if (! $result)
			{
				$this->error=$this->db->lasterror();
				$this->db->rollback();
				return -3;
			}

			// Supprimer l'ecriture bancaire si paiement lie a ecriture
			if ($bank_line_id)
			{
				$accline = new AccountLine($this->db);
				$accline->fetch($bank_line_id);
				$result=$accline->delete();
				if ($result < 0)
				{
					$this->error=$accline->error;
					$this->db->rollback();
					return -4;
				}
			}

			if (! $notrigger)
			{
				// Appel des triggers
				include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
				$interface=new Interfaces($this->db);
				$result=$interface->run_triggers('PAYMENT_DELETE',$this,$user,$langs,$conf);
				if ($result < 0) { $error++; $this->errors=$interface->errors; }
				// Fin appel triggers
			}

			$this->db->commit();
			return 1;
		}
		else
		{
			$this->error=$this->db->error;
			$this->db->rollback();
			return -5;
		}
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:98,代码来源:paiement.class.php


注:本文中的AccountLine::delete_urls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。