Example #1
0
 public function update(Livraison $livraison)
 {
     $query = $this->_db->prepare('UPDATE t_livraison SET dateLivraison=:dateLivraison, libelle=:libelle
     WHERE id=:id') or die(print_r($this->_db->errorInfo()));
     $query->bindValue(':dateLivraison', $livraison->dateLivraison());
     $query->bindValue(':libelle', $livraison->libelle());
     $query->bindValue(':id', $livraison->id());
     $query->execute();
     $query->closeCursor();
 }
 public function update(Livraison $livraison)
 {
     $query = $this->_db->prepare('UPDATE t_livraison SET dateLivraison=:dateLivraison, libelle=:libelle, type=:type,
     idProjet=:idProjet, idFournisseur=:idFournisseur, updated=:updated, updatedBy=:updatedBy
     WHERE id=:id') or die(print_r($this->_db->errorInfo()));
     $query->bindValue(':id', $livraison->id());
     $query->bindValue(':dateLivraison', $livraison->dateLivraison());
     $query->bindValue(':libelle', $livraison->libelle());
     $query->bindValue(':type', $livraison->type());
     $query->bindValue(':idProjet', $livraison->idProjet());
     $query->bindValue(':idFournisseur', $livraison->idFournisseur());
     $query->bindValue(':updated', $livraison->updated());
     $query->bindValue(':updatedBy', $livraison->updatedBy());
     $query->execute();
     $query->closeCursor();
 }
Example #3
0
	}
	else
	{
		dol_print_error($db);
	}
}
else
/* *************************************************************************** */
/*                                                                             */
/* Mode vue et edition                                                         */
/*                                                                             */
/* *************************************************************************** */
{
	if ($_GET["id"] > 0)
	{
		$delivery = new Livraison($db);
		$result = $delivery->fetch($_GET["id"]);
		$delivery->fetch_thirdparty();

		$expedition=new Expedition($db);
		$result = $expedition->fetch($delivery->origin_id);
		$typeobject = $expedition->origin;

		if ($delivery->origin_id)
		{
			$delivery->fetch_origin();
		}

		if ( $delivery->id > 0)
		{
			$soc = new Societe($db);
Example #4
0
 /**
  *      Renvoie un tableau avec les livraisons par ligne
  *      @param      filtre_statut       Filtre sur statut
  *      @return     int                 0 si OK, <0 si KO
  *      TODO  deprecated, move to Shipping class
  */
 function livraison_array($filtre_statut = -1)
 {
     $delivery = new Livraison($this->db);
     $deliveryArray = $delivery->livraison_array($filtre_statut);
     return $deliveryArray;
 }
Example #5
0
    require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
}
$langs->load("sendings");
$langs->load("bills");
$langs->load('deliveries');
$langs->load('orders');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$backtopage = GETPOST('backtopage');
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'expedition', $id, 'livraison', 'livraison');
$object = new Livraison($db);
// Load object
if ($id > 0 || !empty($ref)) {
    $ret = $object->fetch($id, $ref);
    if ($ret > 0) {
        $ret = $object->fetch_thirdparty();
    }
    if ($ret < 0) {
        dol_print_error('', $object->error);
    }
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('deliverycard', 'globalcard'));
/*
 * Actions
 */
Example #6
0
 /**
  *	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;
     }
 }
Example #7
0
     $langs->load("errors");
     print '<div class="error">' . $langs->trans($tmp) . '</div>';
 } elseif ($tmp == 'NotConfigured') {
     print $langs->trans($tmp);
 } else {
     print $tmp;
 }
 print '</td>' . "\n";
 print '<td align="center">';
 if ($conf->global->LIVRAISON_ADDON == "{$file}") {
     print img_picto($langs->trans("Activated"), 'switch_on');
 } else {
     print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=' . $file . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
 }
 print '</td>';
 $livraison = new Livraison($db);
 $livraison->initAsSpecimen();
 // Info
 $htmltooltip = '';
 $htmltooltip .= '' . $langs->trans("Version") . ': <b>' . $module->getVersion() . '</b><br>';
 $nextval = $module->getNextValue($mysoc, $livraison);
 if ("{$nextval}" != $langs->trans("NotAvailable")) {
     $htmltooltip .= '' . $langs->trans("NextValue") . ': ';
     if ($nextval) {
         $htmltooltip .= $nextval . '<br>';
     } else {
         $htmltooltip .= $langs->trans($module->error) . '<br>';
     }
 }
 print '<td align="center">';
 print $form->textwithpicto('', $htmltooltip, 1, 0);
Example #8
0
 /**
  *	Return a array with sendings by line
  *
  *	@param      int		$filtre_statut      Filtre sur statut
  *	@return     int                 		0 si OK, <0 si KO
  *
  *	TODO  deprecate, move to Shipping class
  */
 function livraison_array($filtre_statut = self::STATUS_CANCELED)
 {
     $delivery = new Livraison($this->db);
     $deliveryArray = $delivery->livraison_array($filtre_statut);
     return $deliveryArray;
 }
Example #9
0
require_once "auth.php";
if (!est_autorise("acces_commandes")) {
    exit;
}
$commande = new Commande();
$commande->charger_ref($ref);
if (file_exists(__DIR__ . '/../client/pdf/modeles/facture.php')) {
    $commande = new Commande();
    $commande->charger_ref($ref);
    $client = new Client();
    $client->charger_id($commande->client);
    $pays = new Pays();
    $pays->charger($client->pays);
    $zone = new Zone();
    $zone->charger($pays->zone);
    require_once "../client/pdf/modeles/livraison.php";
    $livraison = new Livraison();
    $livraison->creer($ref);
    exit;
}
$nom_fichier_pdf = $commande->livraison . '.pdf';
// Le moteur ne sortira pas le contenu de $res
$sortie = false;
// Le fond est le template de livraison.
$reptpl = __DIR__ . "/../client/pdf/template/";
$fond = "livraison.html";
$lang = $commande->lang;
// Compatibilité avec le moteur.
$_REQUEST['commande'] = $ref;
require_once __DIR__ . "/../fonctions/moteur.php";
Pdf::instance()->generer($res, $nom_fichier_pdf);
Example #10
0
/**
 *	Create object on disk
 *
 *	@param	DoliDB		$db  			objet base de donnee
 *	@param	Livraison		$object			object delivery
 *	@param	string		$modele			force le modele a utiliser ('' to not force)
 *	@param	Translate	$outputlangs	objet lang a utiliser pour traduction
 *  @return int         				0 if KO, 1 if OK
 * @deprecated Use the new function generateDocument of Livraison class
 * @see Livraison::generateDocument()
 */
function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs = '')
{
    dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
    return $object->generateDocument($modele, $outputlangs);
}
Example #11
0
/**
 *	Create object on disk
 *
 *	@param	DoliDB		$db  			objet base de donnee
 *	@param	Object		$object			object delivery
 *	@param	string		$modele			force le modele a utiliser ('' to not force)
 *	@param	Translate	$outputlangs	objet lang a utiliser pour traduction
 *  @return int         				0 if KO, 1 if OK
 * @deprecated Use the new function generateDocument of Livraison class
 */
function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs = '')
{
    return $object->generateDocument($modele, $outputlangs);
}
Example #12
0
function delivery_order_delete_preview($db, $deliveryid)
{
	global $langs,$conf;
    require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");

	$delivery = new Livraison($db,"",$deliveryid);
	$delivery->fetch($deliveryid);
	$client = new Societe($db);
	$client->fetch($delivery->socid);

	if ($conf->livraison->dir_output)
	{
		$deliveryref = dol_sanitizeFileName($delivery->ref);
		$dir = $conf->livraison->dir_output . "/" . $deliveryref ;
		$file = $dir . "/" . $deliveryref . ".pdf.png";

		if ( file_exists( $file ) && is_writable( $file ) )
		{
			if ( ! dol_delete_file($file,1) )
			{
				$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
				return 0;
			}
		}
	}

	return 1;
}