コード例 #1
0
ファイル: expedition.class.php プロジェクト: Albertopf/prueba
 /**
  *	Create a delivery receipt from a shipment
  *
  *	@param	User	$user       User
  *  @return int  				<0 if KO, >=0 if OK
  */
 function create_delivery($user)
 {
     global $conf;
     if ($conf->livraison_bon->enabled) {
         if ($this->statut == 1 || $this->statut == 2) {
             // Expedition validee
             include_once DOL_DOCUMENT_ROOT . '/livraison/class/livraison.class.php';
             $delivery = new Livraison($this->db);
             $result = $delivery->create_from_sending($user, $this->id);
             if ($result > 0) {
                 return $result;
             } else {
                 $this->error = $delivery->error;
                 return $result;
             }
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }