コード例 #1
0
ファイル: document.php プロジェクト: remyyounes/dolibarr
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";

$object = new Propal($db);

/*
 * Actions
 */

// Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
	if ($object->fetch($id))
    {
        $object->fetch_thirdparty();

    	$upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref);

		if (create_exdir($upload_dir) >= 0)
		{
			$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
			if (is_numeric($resupload) && $resupload > 0)
			{
				$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
			}
			else
			{
				$langs->load("errors");
コード例 #2
0
ファイル: fiche.php プロジェクト: remyyounes/dolibarr
	}
	else
	{
		$reload = 0;
		$action='';
	}
}


/*
 * Ajout du produit dans une propal
 */
if ($action == 'addinpropal')
{
	$propal = new Propal($db);
	$result=$propal->fetch($_POST["propalid"]);
	if ($result <= 0)
	{
		dol_print_error($db,$propal->error);
		exit;
	}

	$soc = new Societe($db);
	$result=$soc->fetch($propal->socid);
	if ($result <= 0)
	{
		dol_print_error($db,$soc->error);
		exit;
	}

	$prod = new Product($db);
コード例 #3
0
ファイル: contact.php プロジェクト: nrjacker4/crm-php
$langs->load("companies");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
$action = GETPOST('action', 'alpha');
// Security check
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'propale', $id, 'propal');
$object = new Propal($db);
/*
 * Ajout d'un nouveau contact
 */
if ($action == 'addcontact' && $user->rights->propale->creer) {
    $result = $object->fetch($id);
    if ($result > 0 && $id > 0) {
        $contactid = GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int');
        $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
    }
    if ($result >= 0) {
        Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
        exit;
    } else {
        if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            $langs->load("errors");
            $mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
        } else {
            $mesg = '<div class="error">' . $object->error . '</div>';
        }
    }
コード例 #4
0
ファイル: propal.php プロジェクト: remyyounes/dolibarr
/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/

if ($_GET["action"] == 'setstatut')
{
	// Close proposal
	$object->id = $_GET["id"];
	$object->cloture($user, $_GET["statut"], $note);

}

// Set project
if ($_POST['action'] == 'classin')
{
	$object->fetch($_GET["id"]);
	$object->setProject($_POST['projectid']);
}



/*
 * View
 */

$now=gmmktime();

llxHeader();

$html = new Form($db);
$htmlother = new FormOther($db);
コード例 #5
0
ファイル: card.php プロジェクト: Albertopf/prueba
     }
     if ($result > 0) {
         header('Location: ' . DOL_URL_ROOT . '/product/list.php?type=' . $object->type . '&delprod=' . urlencode($object->ref));
         exit;
     } else {
         setEventMessages($langs->trans($object->error), null, 'errors');
         $reload = 0;
         $action = '';
     }
 }
 // Add product into object
 if ($object->id > 0 && $action == 'addin') {
     $thirpdartyid = 0;
     if (GETPOST('propalid') > 0) {
         $propal = new Propal($db);
         $result = $propal->fetch(GETPOST('propalid'));
         if ($result <= 0) {
             dol_print_error($db, $propal->error);
             exit;
         }
         $thirpdartyid = $propal->socid;
     } elseif (GETPOST('commandeid') > 0) {
         $commande = new Commande($db);
         $result = $commande->fetch(GETPOST('commandeid'));
         if ($result <= 0) {
             dol_print_error($db, $commande->error);
             exit;
         }
         $thirpdartyid = $commande->socid;
     } elseif (GETPOST('factureid') > 0) {
         $facture = new Facture($db);
コード例 #6
0
ファイル: apercu.php プロジェクト: Samara94/dolibarr
// Security check
$socid = 0;
$id = GETPOST('id', 'int');
$ref = GETPOST("ref");
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'propal', $id);
/*
 * View Mode
 */
$form = new Form($db);
llxHeader();
if ($id > 0 || !empty($ref)) {
    $object = new Propal($db);
    if ($object->fetch($id, $ref) > 0) {
        $soc = new Societe($db);
        $soc->fetch($object->socid);
        $head = propal_prepare_head($object);
        dol_fiche_head($head, 'preview', $langs->trans('Proposal'), 0, 'propal');
        /*
         *   Propal
         */
        print '<table class="border" width="100%">';
        $linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (!empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
        // Ref
        print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
        print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
        print '</td></tr>';
        // Ref client
        print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
コード例 #7
0
ファイル: propal.class.php プロジェクト: rafso/cliente
 /**
  *		Load an object from its id and create a new one in database
  *		@param      fromid     		Id of object to clone
  *		@param		invertdetail	Reverse sign of amounts for lines
  *		@param		socid			Id of thirdparty
  * 	 	@return		int				New id of clone
  */
 function createFromClone($fromid, $invertdetail = 0, $socid = 0)
 {
     global $user, $langs, $conf;
     $error = 0;
     $now = dol_now();
     $object = new Propal($this->db);
     // Instantiate hooks of thirdparty module
     if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules)) {
         $object->callHooks('propalcard');
     }
     $this->db->begin();
     // Load source object
     $object->fetch($fromid);
     $objFrom = $object;
     $objsoc = new Societe($this->db);
     // Change socid if needed
     if (!empty($socid) && $socid != $object->socid) {
         if ($objsoc->fetch($socid) > 0) {
             $object->socid = $objsoc->id;
             $object->cond_reglement_id = !empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0;
             $object->mode_reglement_id = !empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0;
             $object->fk_project = '';
             $object->fk_delivery_address = '';
         }
         // TODO Change product price if multi-prices
     } else {
         $objsoc->fetch($object->socid);
     }
     $object->id = 0;
     $object->statut = 0;
     $objsoc->fetch($object->socid);
     if (empty($conf->global->PROPALE_ADDON) || !is_readable(DOL_DOCUMENT_ROOT . "/includes/modules/propale/" . $conf->global->PROPALE_ADDON . ".php")) {
         $this->error = 'ErrorSetupNotComplete';
         return -1;
     }
     // Clear fields
     $object->user_author = $user->id;
     $object->user_valid = '';
     $object->date = '';
     $object->datep = $now;
     $object->fin_validite = $object->datep + $this->duree_validite * 24 * 3600;
     $object->ref_client = '';
     // Set ref
     require_once DOL_DOCUMENT_ROOT . "/includes/modules/propale/" . $conf->global->PROPALE_ADDON . ".php";
     $obj = $conf->global->PROPALE_ADDON;
     $modPropale = new $obj();
     $object->ref = $modPropale->getNextValue($objsoc, $object);
     // Create clone
     $result = $object->create($user);
     // Other options
     if ($result < 0) {
         $this->error = $object->error;
         $error++;
     }
     if (!$error) {
         // Hook for external modules
         if (!empty($object->hooks)) {
             foreach ($object->hooks as $hook) {
                 if (!empty($hook['modules'])) {
                     foreach ($hook['modules'] as $module) {
                         if (method_exists($module, 'createfrom')) {
                             $result = $module->createfrom($objFrom, $result, $object->element);
                             if ($result < 0) {
                                 $error++;
                             }
                         }
                     }
                 }
             }
         }
         // Appel des triggers
         include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
         $interface = new Interfaces($this->db);
         $result = $interface->run_triggers('PROPAL_CLONE', $object, $user, $langs, $conf);
         if ($result < 0) {
             $error++;
             $this->errors = $interface->errors;
         }
         // Fin appel triggers
     }
     // End
     if (!$error) {
         $this->db->commit();
         return $object->id;
     } else {
         $this->db->rollback();
         return -1;
     }
 }
コード例 #8
0
ファイル: shipment.php プロジェクト: remyyounes/dolibarr
		if ($absolute_creditnote)
		{
			print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
		}
		if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
		print '</td></tr>';

		// Date
		print '<tr><td>'.$langs->trans('Date').'</td>';
		print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
		print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
		if ($commande->source == 0 && $conf->propal->enabled && $commande->propale_id)
		{
			// Si source = propal
			$propal = new Propal($db);
			$propal->fetch($commande->propale_id);
			print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$propal->id.'">'.$propal->ref.'</a>';
		}
		print '</td>';
		print '</tr>';

		// Delivery date planned
		print '<tr><td height="10">';
		print '<table class="nobordernopadding" width="100%"><tr><td>';
		print $langs->trans('DateDeliveryPlanned');
		print '</td>';

		if ($_GET['action'] != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
		print '</tr></table>';
		print '</td><td colspan="2">';
		if ($_GET['action'] == 'editdate_livraison')
コード例 #9
0
ファイル: info.php プロジェクト: remyyounes/dolibarr
$id = isset($_GET["id"])?$_GET["id"]:'';

// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propale', $id, 'propal');


/*
 *	View
 */

llxHeader();

$propal = new Propal($db);
$propal->fetch($_GET["id"]);

$societe = new Societe($db);
$societe->fetch($propal->socid);

$head = propal_prepare_head($propal);
dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal');

$propal->info($propal->id);

print '<table width="100%"><tr><td>';
dol_print_object_info($propal);
print '</td></tr></table>';

print '</div>';
コード例 #10
0
    }
} else {
    if ($type_tag == 'rel') {
        $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "twiiit WHERE comment LIKE '%:" . $db->escape($tag) . "%'");
        $PDOdb = new TPDOdb();
        while ($obj = $db->fetch_object($res)) {
            $twiiit = new TTwiiit();
            $twiiit->load($PDOdb, $obj->rowid);
            $Tab[] = array('link' => $twiiit->getNomUrl(), 'text' => $twiiit->getComment());
        }
    } else {
        if ($type_tag == 'hashtag') {
            $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "propal WHERE ref = '" . $db->escape($tag) . "'");
            while ($obj = $db->fetch_object($res)) {
                $o = new Propal($db);
                $o->fetch($obj->rowid);
                $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'user');
            }
            $res = $db->query("SELECT rowid  FROM " . MAIN_DB_PREFIX . "facture WHERE facnumber = '" . $db->escape($tag) . "'");
            while ($obj = $db->fetch_object($res)) {
                $o = new Facture($db);
                $o->fetch($obj->rowid);
                $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'societe');
            }
            $res = $db->query("SELECT rowid  FROM " . MAIN_DB_PREFIX . "product WHERE ref = '" . $db->escape($tag) . "'");
            while ($obj = $db->fetch_object($res)) {
                $o = new Product($db);
                $o->fetch($obj->rowid);
                $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'societe');
            }
        } else {
コード例 #11
0
function _task_propal(&$db, $fk_propal)
{
    global $conf, $langs, $user;
    if (empty($conf->nomenclature->enabled)) {
        return array();
    }
    $PDOdb = new TPDOdb();
    dol_include_once('/comm/propal/class/propal.class.php');
    dol_include_once('/nomenclature/class/nomenclature.class.php');
    $o = new Propal($db);
    $o->fetch($fk_propal);
    $TTask = _task_from_line_object($PDOdb, $o->lines, 'propal');
    return $TTask;
}
コード例 #12
0
$sql = 'SELECT p.rowid FROM ' . MAIN_DB_PREFIX . 'propal p 
		INNER JOIN ' . MAIN_DB_PREFIX . 'propal_extrafields pe ON (p.rowid = pe.fk_object) 
		WHERE p.entity = ' . $conf->entity . ' 
		AND p.fk_statut = 1
		AND pe.date_relance = "' . $db->escape($today) . '"';
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql) > 0) {
    $msgishtml = $conf->fckeditor->enabled && !empty($conf->global->FCKEDITOR_ENABLE_MAIL) ? 1 : 0;
    while ($line = $db->fetch_object($resql)) {
        $subject = $conf->global->PROPALAUTOSEND_MSG_SUBJECT;
        if (empty($subject)) {
            exit("errorSubjectMailIsEmpty");
        }
        $contactFound = false;
        $propal = new Propal($db);
        $propal->fetch($line->rowid);
        $propal->fetch_thirdparty();
        $TSearchPropal = array('__PROPAL_ref', '__PROPAL_ref_client', '__PROPAL_total_ht', '__PROPAL_total_tva', '__PROPAL_total_ttc', '__PROPAL_datep', '__PROPAL_fin_validite');
        $TValPropal = array($propal->ref, $propal->ref_client, $propal->total_ht, $propal->total_tva, $propal->total_ttc, dol_print_date($propal->datep, '%d/%m/%Y'), dol_print_date($propal->fin_validite, '%d/%m/%Y'));
        foreach ($TSearchPropal as $i => $propal_value) {
            $subject = preg_replace('/' . $propal_value . '\\b/', $TValPropal[$i], $subject);
        }
        if ($propal->user_author_id > 0) {
            $newUser = new User($db);
            $newUser->fetch($propal->user_author_id);
        } else {
            $newUser =& $user;
        }
        $filename_list = array();
        $mimetype_list = array();
        $mimefilename_list = array();
コード例 #13
0
ファイル: fiche.php プロジェクト: remyyounes/dolibarr
			if ($typeobject == 'commande' && $object->$typeobject->id && $conf->commande->enabled)
			{
				print '<tr><td>';
				$objectsrc=new Commande($db);
				$objectsrc->fetch($object->$typeobject->id);
				print $langs->trans("RefOrder").'</td>';
				print '<td colspan="3">';
				print $objectsrc->getNomUrl(1,'commande');
				print "</td>\n";
				print '</tr>';
			}
			if ($typeobject == 'propal' && $object->$typeobject->id && $conf->propal->enabled)
			{
				print '<tr><td>';
				$objectsrc=new Propal($db);
				$objectsrc->fetch($object->$typeobject->id);
				print $langs->trans("RefProposal").'</td>';
				print '<td colspan="3">';
				print $objectsrc->getNomUrl(1,'expedition');
				print "</td>\n";
				print '</tr>';
			}

			// Ref customer
			print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
			print '<td colspan="3">'.$object->ref_customer."</a></td>\n";
			print '</tr>';

			// Date creation
			print '<tr><td>'.$langs->trans("DateCreation").'</td>';
			print '<td colspan="3">'.dol_print_date($object->date_creation,"daytext")."</td>\n";
コード例 #14
0
ファイル: commande.class.php プロジェクト: Albertopf/prueba
 /**
  *	Create order
  *	Note that this->ref can be set or empty. If empty, we will use "(PROV)"
  *
  *	@param		User	$user 		Objet user that make creation
  *	@param		int	$notrigger	Disable all triggers
  *	@return 	int			<0 if KO, >0 if OK
  */
 function create($user, $notrigger = 0)
 {
     global $conf, $langs, $mysoc, $hookmanager;
     $error = 0;
     // Clean parameters
     $this->brouillon = 1;
     // set command as draft
     dol_syslog(get_class($this) . "::create user="******"::create " . $this->error, LOG_WARNING);
             $this->db->rollback();
             return -1;
         }
     }
     $soc = new Societe($this->db);
     $result = $soc->fetch($this->socid);
     if ($result < 0) {
         $this->error = "Failed to fetch company";
         dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
         return -2;
     }
     if (!empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) {
         $this->error = $langs->trans("ErrorFieldRequired", $langs->trans("Source"));
         dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
         return -1;
     }
     // $date_commande is deprecated
     $date = $this->date_commande ? $this->date_commande : $this->date;
     $now = dol_now();
     $this->db->begin();
     $sql = "INSERT INTO " . MAIN_DB_PREFIX . "commande (";
     $sql .= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
     $sql .= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
     $sql .= ", fk_shipping_method";
     $sql .= ", fk_warehouse";
     $sql .= ", remise_absolue, remise_percent";
     $sql .= ", fk_incoterms, location_incoterms";
     $sql .= ", entity";
     $sql .= ")";
     $sql .= " VALUES ('(PROV)'," . $this->socid . ", '" . $this->db->idate($now) . "', " . $user->id;
     $sql .= ", " . ($this->fk_project > 0 ? $this->fk_project : "null");
     $sql .= ", '" . $this->db->idate($date) . "'";
     $sql .= ", " . ($this->source >= 0 && $this->source != '' ? $this->db->escape($this->source) : 'null');
     $sql .= ", '" . $this->db->escape($this->note_private) . "'";
     $sql .= ", '" . $this->db->escape($this->note_public) . "'";
     $sql .= ", " . ($this->ref_ext ? "'" . $this->db->escape($this->ref_ext) . "'" : "null");
     $sql .= ", " . ($this->ref_client ? "'" . $this->db->escape($this->ref_client) . "'" : "null");
     $sql .= ", " . ($this->ref_int ? "'" . $this->db->escape($this->ref_int) . "'" : "null");
     $sql .= ", '" . $this->db->escape($this->modelpdf) . "'";
     $sql .= ", " . ($this->cond_reglement_id > 0 ? "'" . $this->cond_reglement_id . "'" : "null");
     $sql .= ", " . ($this->mode_reglement_id > 0 ? "'" . $this->mode_reglement_id . "'" : "null");
     $sql .= ", " . ($this->fk_account > 0 ? $this->fk_account : 'NULL');
     $sql .= ", " . ($this->availability_id > 0 ? "'" . $this->availability_id . "'" : "null");
     $sql .= ", " . ($this->demand_reason_id > 0 ? "'" . $this->demand_reason_id . "'" : "null");
     $sql .= ", " . ($this->date_livraison ? "'" . $this->db->idate($this->date_livraison) . "'" : "null");
     $sql .= ", " . ($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL');
     $sql .= ", " . ($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
     $sql .= ", " . ($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL');
     $sql .= ", " . ($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL');
     $sql .= ", " . ($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0);
     $sql .= ", " . (int) $this->fk_incoterms;
     $sql .= ", '" . $this->db->escape($this->location_incoterms) . "'";
     $sql .= ", " . $conf->entity;
     $sql .= ")";
     dol_syslog(get_class($this) . "::create", LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . 'commande');
         if ($this->id) {
             $fk_parent_line = 0;
             $num = count($this->lines);
             /*
              *  Insert products details into db
              */
             for ($i = 0; $i < $num; $i++) {
                 // Reset fk_parent_line for no child products and special product
                 if ($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line) || $this->lines[$i]->product_type == 9) {
                     $fk_parent_line = 0;
                 }
                 $result = $this->addline($this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, $this->lines[$i]->tva_tx, $this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax2_tx, $this->lines[$i]->fk_product, $this->lines[$i]->remise_percent, $this->lines[$i]->info_bits, $this->lines[$i]->fk_remise_except, 'HT', 0, $this->lines[$i]->date_start, $this->lines[$i]->date_end, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label, $this->lines[$i]->array_options, $this->lines[$i]->fk_unit, $this->element, $this->lines[$i]->id);
                 if ($result < 0) {
                     if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) {
                         $this->error = $this->db->lasterror();
                         dol_print_error($this->db);
                     }
                     $this->db->rollback();
                     return -1;
                 }
                 // Defined the new fk_parent_line
                 if ($result > 0 && $this->lines[$i]->product_type == 9) {
                     $fk_parent_line = $result;
                 }
             }
             // update ref
             $initialref = '(PROV' . $this->id . ')';
             if (!empty($this->ref)) {
                 $initialref = $this->ref;
             }
             $sql = 'UPDATE ' . MAIN_DB_PREFIX . "commande SET ref='" . $this->db->escape($initialref) . "' WHERE rowid=" . $this->id;
             if ($this->db->query($sql)) {
                 if ($this->id) {
                     $this->ref = $initialref;
                     // Add object linked
                     if (is_array($this->linked_objects) && !empty($this->linked_objects)) {
                         foreach ($this->linked_objects as $origin => $origin_id) {
                             $ret = $this->add_object_linked($origin, $origin_id);
                             if (!$ret) {
                                 dol_print_error($this->db);
                                 $error++;
                             }
                             // TODO mutualiser
                             if ($origin == 'propal' && $origin_id) {
                                 // On recupere les differents contact interne et externe
                                 $prop = new Propal($this->db);
                                 $prop->fetch($origin_id);
                                 // We get ids of sales representatives of proposal
                                 $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
                                 if ($this->userid) {
                                     //On passe le commercial suivi propale en commercial suivi commande
                                     $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
                                 }
                                 // We get ids of customer follower of proposal
                                 $this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
                                 if ($this->contactid) {
                                     //On passe le contact client suivi propale en contact client suivi commande
                                     $this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
                                 }
                             }
                         }
                     }
                 }
                 if (!$error) {
                     //$action='create';
                     // Actions on extra fields (by external module or standard code)
                     // TODO le hook fait double emploi avec le trigger !!
                     /*$hookmanager->initHooks(array('orderdao'));
                       $parameters=array('socid'=>$this->id);
                       $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
                       if (empty($reshook))
                       {
                       	if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
                       	{*/
                     $result = $this->insertExtraFields();
                     if ($result < 0) {
                         $error++;
                     }
                     /*	}
                        }
                        else if ($reshook < 0) $error++;*/
                 }
                 if (!$error && !$notrigger) {
                     // Call trigger
                     $result = $this->call_trigger('ORDER_CREATE', $user);
                     if ($result < 0) {
                         $error++;
                     }
                     // End call triggers
                 }
                 if (!$error) {
                     $this->db->commit();
                     return $this->id;
                 } else {
                     $this->db->rollback();
                     return -1 * $error;
                 }
             } else {
                 $this->error = $this->db->lasterror();
                 $this->db->rollback();
                 return -1;
             }
         }
     } else {
         dol_print_error($this->db);
         $this->db->rollback();
         return -1;
     }
 }
コード例 #15
0
/**
 *    	Show html area with actions done
 *
 * 		@param	Conf		$conf		Object conf
 * 		@param	Translate	$langs		Object langs
 * 		@param	DoliDB		$db			Object db
 * 		@param	Adherent|Societe		$object		Object third party or member
 * 		@param	Contact		$objcon		Object contact
 *      @param  int			$noprint    Return string but does not output it
 *      @return	mixed					Return html part or void if noprint is 1
 * TODO change function to be able to list event linked to an object.
 */
function show_actions_done($conf, $langs, $db, $object, $objcon = '', $noprint = 0)
{
    global $bc, $user, $conf;
    // Check parameters
    if (!is_object($object)) {
        dol_print_error('', 'BadParameter');
    }
    $out = '';
    $histo = array();
    $numaction = 0;
    $now = dol_now('tzuser');
    if (!empty($conf->agenda->enabled)) {
        // Recherche histo sur actioncomm
        $sql = "SELECT a.id, a.label,";
        $sql .= " a.datep as dp,";
        $sql .= " a.datep2 as dp2,";
        $sql .= " a.note, a.percent,";
        $sql .= " a.fk_element, a.elementtype,";
        $sql .= " a.fk_user_author, a.fk_contact,";
        $sql .= " c.code as acode, c.libelle,";
        $sql .= " u.login, u.rowid as user_id";
        if (get_class($object) == 'Societe') {
            $sql .= ", sp.lastname, sp.firstname";
        }
        if (get_class($object) == 'Adherent') {
            $sql .= ", m.lastname, m.firstname";
        }
        $sql .= " FROM " . MAIN_DB_PREFIX . "user as u, " . MAIN_DB_PREFIX . "actioncomm as a";
        $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_actioncomm as c ON a.fk_action = c.id";
        if (get_class($object) == 'Societe') {
            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sp ON a.fk_contact = sp.rowid";
        }
        if (get_class($object) == 'Adherent') {
            $sql .= ", " . MAIN_DB_PREFIX . "adherent as m";
        }
        $sql .= " WHERE u.rowid = a.fk_user_author";
        $sql .= " AND a.entity IN (" . getEntity('agenda', 1) . ")";
        if (get_class($object) == 'Societe' && $object->id) {
            $sql .= " AND a.fk_soc = " . $object->id;
        }
        if (get_class($object) == 'Adherent') {
            $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
        }
        if (get_class($object) == 'Adherent' && $object->id) {
            $sql .= " AND a.fk_element = " . $object->id;
        }
        if (is_object($objcon) && $objcon->id) {
            $sql .= " AND a.fk_contact = " . $objcon->id;
        }
        $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '" . $db->idate($now) . "'))";
        $sql .= " ORDER BY a.datep DESC, a.id DESC";
        dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
        $resql = $db->query($sql);
        if ($resql) {
            $i = 0;
            $num = $db->num_rows($resql);
            $var = true;
            while ($i < $num) {
                $obj = $db->fetch_object($resql);
                $histo[$numaction] = array('type' => 'action', 'id' => $obj->id, 'datestart' => $db->jdate($obj->dp), 'dateend' => $db->jdate($obj->dp2), 'note' => $obj->label, 'percent' => $obj->percent, 'acode' => $obj->acode, 'libelle' => $obj->libelle, 'userid' => $obj->user_id, 'login' => $obj->login, 'contact_id' => $obj->fk_contact, 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'fk_element' => $obj->fk_element, 'elementtype' => $obj->elementtype);
                $numaction++;
                $i++;
            }
        } else {
            dol_print_error($db);
        }
    }
    if (!empty($conf->mailing->enabled) && !empty($objcon->email)) {
        $langs->load("mails");
        // Recherche histo sur mailing
        $sql = "SELECT m.rowid as id, mc.date_envoi as da, m.titre as note, '100' as percentage,";
        $sql .= " 'AC_EMAILING' as acode,";
        $sql .= " u.rowid as user_id, u.login";
        // User that valid action
        $sql .= " FROM " . MAIN_DB_PREFIX . "mailing as m, " . MAIN_DB_PREFIX . "mailing_cibles as mc, " . MAIN_DB_PREFIX . "user as u";
        $sql .= " WHERE mc.email = '" . $db->escape($objcon->email) . "'";
        // Search is done on email.
        $sql .= " AND mc.statut = 1";
        $sql .= " AND u.rowid = m.fk_user_valid";
        $sql .= " AND mc.fk_mailing=m.rowid";
        $sql .= " ORDER BY mc.date_envoi DESC, m.rowid DESC";
        dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
        $resql = $db->query($sql);
        if ($resql) {
            $i = 0;
            $num = $db->num_rows($resql);
            $var = true;
            while ($i < $num) {
                $obj = $db->fetch_object($resql);
                $histo[$numaction] = array('type' => 'mailing', 'id' => $obj->id, 'datestart' => $db->jdate($obj->da), 'dateend' => $db->jdate($obj->da), 'note' => $obj->note, 'percent' => $obj->percentage, 'acode' => $obj->acode, 'userid' => $obj->user_id, 'login' => $obj->login);
                $numaction++;
                $i++;
            }
            $db->free($resql);
        } else {
            dol_print_error($db);
        }
    }
    if (!empty($conf->agenda->enabled) || !empty($conf->mailing->enabled) && !empty($objcon->email)) {
        require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
        require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
        require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
        require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
        $actionstatic = new ActionComm($db);
        $userstatic = new User($db);
        $contactstatic = new Contact($db);
        // TODO uniformize
        $propalstatic = new Propal($db);
        $orderstatic = new Commande($db);
        $facturestatic = new Facture($db);
        $out .= "\n";
        $out .= '<table class="noborder" width="100%">';
        $out .= '<tr class="liste_titre">';
        if ($conf->global->AGENDA_USE_EVENT_TYPE) {
            $out .= '<td colspan="3">';
        } else {
            $out .= '<td colspan="2">';
        }
        if (get_class($object) == 'Societe') {
            $out .= '<a href="' . DOL_URL_ROOT . '/comm/action/listactions.php?socid=' . $object->id . '&amp;status=done">';
        }
        $out .= $langs->trans("ActionsDoneShort");
        if (get_class($object) == 'Societe') {
            $out .= '</a>';
        }
        $out .= '</td>';
        if ($conf->global->AGENDA_USE_EVENT_TYPE) {
            $out .= '<td>';
            $out .= $langs->trans("Type");
            $out .= '</td>';
            $out .= '<td colspan="4" align="right">';
        } else {
            $out .= '<td colspan="5" align="right">';
        }
        $out .= '</td>';
        $out .= '</tr>';
        foreach ($histo as $key => $value) {
            $var = !$var;
            $out .= "<tr " . $bc[$var] . ">";
            $actionstatic->fetch($histo[$key]['id']);
            // Champ date
            $out .= '<td width="120" class="nowrap">';
            $out .= dol_print_date($histo[$key]['datestart'], 'dayhour');
            if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) {
                $tmpa = dol_getdate($histo[$key]['datestart'], true);
                $tmpb = dol_getdate($histo[$key]['dateend'], true);
                if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
                    $out .= '-' . dol_print_date($histo[$key]['dateend'], 'hour');
                } else {
                    $out .= '-' . dol_print_date($histo[$key]['dateend'], 'dayhour');
                }
            }
            $out .= "</td>\n";
            // Picto
            $out .= '<td width="16">&nbsp;</td>';
            // Action
            $out .= '<td>';
            if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
                $actionstatic->type_code = $histo[$key]['acode'];
                $transcode = $langs->trans("Action" . $histo[$key]['acode']);
                $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : $histo[$key]['libelle'];
                //$actionstatic->libelle=$libelle;
                $actionstatic->libelle = $histo[$key]['note'];
                $actionstatic->id = $histo[$key]['id'];
                $out .= $actionstatic->getNomUrl(1, 120);
            }
            if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
                $out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/card.php?id=' . $histo[$key]['id'] . '">' . img_object($langs->trans("ShowEMailing"), "email") . ' ';
                $transcode = $langs->trans("Action" . $histo[$key]['acode']);
                $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : 'Send mass mailing';
                $out .= dol_trunc($libelle, 120);
            }
            $out .= '</td>';
            if ($conf->global->AGENDA_USE_EVENT_TYPE) {
                $out .= '<td>';
                $out .= $actionstatic->type;
                $out .= '</td>';
            }
            // Title of event
            //$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';
            // Objet lie
            // TODO uniformize
            $out .= '<td>';
            //var_dump($histo[$key]['elementtype']);
            if (isset($histo[$key]['elementtype'])) {
                if ($histo[$key]['elementtype'] == 'propal' && !empty($conf->propal->enabled)) {
                    //$propalstatic->ref=$langs->trans("ProposalShort");
                    //$propalstatic->id=$histo[$key]['fk_element'];
                    if ($propalstatic->fetch($histo[$key]['fk_element']) > 0) {
                        $propalstatic->type = $histo[$key]['ftype'];
                        $out .= $propalstatic->getNomUrl(1);
                    } else {
                        $out .= $langs->trans("ProposalDeleted");
                    }
                } elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && !empty($conf->commande->enabled)) {
                    //$orderstatic->ref=$langs->trans("Order");
                    //$orderstatic->id=$histo[$key]['fk_element'];
                    if ($orderstatic->fetch($histo[$key]['fk_element']) > 0) {
                        $orderstatic->type = $histo[$key]['ftype'];
                        $out .= $orderstatic->getNomUrl(1);
                    } else {
                        $out .= $langs->trans("OrderDeleted");
                    }
                } elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && !empty($conf->facture->enabled)) {
                    //$facturestatic->ref=$langs->trans("Invoice");
                    //$facturestatic->id=$histo[$key]['fk_element'];
                    if ($facturestatic->fetch($histo[$key]['fk_element']) > 0) {
                        $facturestatic->type = $histo[$key]['ftype'];
                        $out .= $facturestatic->getNomUrl(1, 'compta');
                    } else {
                        $out .= $langs->trans("InvoiceDeleted");
                    }
                } else {
                    $out .= '&nbsp;';
                }
            } else {
                $out .= '&nbsp;';
            }
            $out .= '</td>';
            // Contact pour cette action
            if (!empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
                $contactstatic->lastname = $histo[$key]['lastname'];
                $contactstatic->firstname = $histo[$key]['firstname'];
                $contactstatic->id = $histo[$key]['contact_id'];
                $out .= '<td width="120">' . $contactstatic->getNomUrl(1, '', 10) . '</td>';
            } else {
                $out .= '<td>&nbsp;</td>';
            }
            // Auteur
            $out .= '<td class="nowrap" width="80">';
            //$userstatic->id=$histo[$key]['userid'];
            //$userstatic->login=$histo[$key]['login'];
            //$out.=$userstatic->getLoginUrl(1);
            $userstatic->fetch($histo[$key]['userid']);
            $out .= $userstatic->getNomUrl(1);
            $out .= '</td>';
            // Statut
            $out .= '<td class="nowrap" width="20">' . $actionstatic->LibStatut($histo[$key]['percent'], 3) . '</td>';
            $out .= "</tr>\n";
            $i++;
        }
        $out .= "</table>\n";
        $out .= "<br>\n";
    }
    if ($noprint) {
        return $out;
    } else {
        print $out;
    }
}
コード例 #16
0
ファイル: propal.php プロジェクト: Albertopf/prueba
$hidedesc = GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
$hideref = GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
// Nombre de ligne pour choix de produit/service predefinis
$NBLINES = 4;
// Security check
if (!empty($user->societe_id)) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'propal', $id);
$object = new Propal($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// 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('propalcard', 'globalcard'));
$permissionnote = $user->rights->propale->creer;
// Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->propale->creer;
// Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->propale->creer;
// Used by the include of actions_lineupdown.inc.php
コード例 #17
0
function enteteexpedition(&$expedition)
{
    global $langs, $db, $user, $hookmanager, $conf;
    $form = new Form($db);
    $soc = new Societe($db);
    $soc->fetch($expedition->socid);
    if (!empty($expedition->origin)) {
        $typeobject = $expedition->origin;
        $origin = $expedition->origin;
        $expedition->fetch_origin();
    }
    print '<table class="border" width="100%">';
    $linkback = '<a href="' . DOL_URL_ROOT . '/expedition/liste.php">' . $langs->trans("BackToList") . '</a>';
    // Ref
    print '<tr><td width="20%">' . $langs->trans("Ref") . '</td>';
    print '<td colspan="3">';
    print $form->showrefnav($expedition, 'ref', $linkback, 1, 'ref', 'ref');
    print '</td></tr>';
    // Customer
    print '<tr><td width="20%">' . $langs->trans("Customer") . '</td>';
    print '<td colspan="3">' . $soc->getNomUrl(1) . '</td>';
    print "</tr>";
    // Linked documents
    if ($typeobject == 'commande' && $expedition->{$typeobject}->id && !empty($conf->commande->enabled)) {
        print '<tr><td>';
        $objectsrc = new Commande($db);
        $objectsrc->fetch($expedition->{$typeobject}->id);
        print $langs->trans("RefOrder") . '</td>';
        print '<td colspan="3">';
        print $objectsrc->getNomUrl(1, 'commande');
        print "</td>\n";
        print '</tr>';
    }
    if ($typeobject == 'propal' && $expedition->{$typeobject}->id && !empty($conf->propal->enabled)) {
        print '<tr><td>';
        $objectsrc = new Propal($db);
        $objectsrc->fetch($expedition->{$typeobject}->id);
        print $langs->trans("RefProposal") . '</td>';
        print '<td colspan="3">';
        print $objectsrc->getNomUrl(1, 'expedition');
        print "</td>\n";
        print '</tr>';
    }
    // Ref customer
    print '<tr><td>' . $langs->trans("RefCustomer") . '</td>';
    print '<td colspan="3">' . $expedition->ref_customer . "</a></td>\n";
    print '</tr>';
    // Date creation
    print '<tr><td>' . $langs->trans("DateCreation") . '</td>';
    print '<td colspan="3">' . dol_print_date($expedition->date_creation, "day") . "</td>\n";
    print '</tr>';
    // Delivery date planed
    print '<tr><td height="10">';
    print '<table class="nobordernopadding" width="100%"><tr><td>';
    print $langs->trans('DateDeliveryPlanned');
    print '</td>';
    print '</tr></table>';
    print '</td><td colspan="2">';
    print $expedition->date_delivery ? dol_print_date($expedition->date_delivery, 'dayhourtext') : '&nbsp;';
    print '</td>';
    print '</tr>';
    // Status
    print '<tr><td>' . $langs->trans("Status") . '</td>';
    print '<td colspan="3">' . $expedition->getLibStatut(4) . "</td>\n";
    print '</tr>';
    // Sending method
    print '<tr><td height="10">';
    print '<table class="nobordernopadding" width="100%"><tr><td>';
    print $langs->trans('SendingMethod');
    print '</td>';
    print '</tr></table>';
    print '</td><td colspan="2">';
    if ($expedition->shipping_method_id > 0) {
        // Get code using getLabelFromKey
        $code = $langs->getLabelFromKey($db, $expedition->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
        print $langs->trans("SendingMethod" . strtoupper($code));
    }
    print '</td>';
    print '</tr>';
    print "</table>\n";
}
コード例 #18
0
ファイル: note.php プロジェクト: remyyounes/dolibarr
/******************************************************************************/

llxHeader();

$html = new Form($db);

$id = $_GET["id"];
$ref= $_GET["ref"];
if ($id > 0 || ! empty($ref))
{
	if ($mesg) print $mesg;

	$now=gmmktime();

	$propal = new Propal($db);
	if ($propal->fetch($id, $ref))
	{
		$societe = new Societe($db);
		if ( $societe->fetch($propal->socid) )
		{
			$head = propal_prepare_head($propal);
			dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal');

			print '<table class="border" width="100%">';

			$linkback="<a href=\"".$_SERVER["PHP_SELF"]."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>";

			// Ref
			print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
			print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref','');
			print '</td></tr>';
コード例 #19
0
ファイル: apercu.php プロジェクト: nrjacker4/crm-php
if ($id > 0 || !empty($ref)) {
    $object = new Commande($db);
    if ($object->fetch($id, $ref) > 0) {
        $soc = new Societe($db);
        $soc->fetch($object->socid);
        $head = commande_prepare_head($object);
        dol_fiche_head($head, 'preview', $langs->trans("CustomerOrder"), 0, 'order');
        print '<table class="border" width="100%">';
        // Ref
        print '<tr><td width="18%">' . $langs->trans("Ref") . "</td>";
        print '<td colspan="2">' . $object->ref . '</td>';
        print '<td width="50%">' . $langs->trans("Source") . ' : ' . $object->getLabelSource();
        if ($object->source == 0) {
            // Propale
            $propal = new Propal($db);
            $propal->fetch($object->propale_id);
            print ' -> <a href="' . DOL_URL_ROOT . '/comm/propal.php?id=' . $propal->id . '">' . $propal->ref . '</a>';
        }
        print "</td></tr>";
        // Ref cde client
        print '<tr><td>';
        print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
        print $langs->trans('RefCustomer') . '</td><td align="left">';
        print '</td>';
        print '</tr></table>';
        print '</td>';
        print '<td colspan="2">';
        print $object->ref_client;
        print '</td>';
        $nbrow = 6;
        print '<td rowspan="' . $nbrow . '" valign="top">';
コード例 #20
0
ファイル: PropalTest.php プロジェクト: nrjacker4/crm-php
    /**
     * testPropalDelete
     * 
     * @param	int		$id		Id of proposal
     * @return	void
     * 
     * @depends	testPropalOther
     * The depends says test is run only if previous is ok
     */
    public function testPropalDelete($id)
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new Propal($this->savdb);
    	$result=$localobject->fetch($id);
		$result=$localobject->delete($user);

		print __METHOD__." id=".$id." result=".$result."\n";
    	$this->assertLessThan($result, 0);
    	return $result;
    }
コード例 #21
0
ファイル: note.php プロジェクト: nrjacker4/crm-php
$langs->load('compta');
$langs->load('bills');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
// Security check
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'propale', $id, 'propal');
$object = new Propal($db);
/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/
if ($action == 'setnote_public' && $user->rights->propale->creer) {
    $object->fetch($id);
    $result = $object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
    if ($result < 0) {
        dol_print_error($db, $object->error);
    }
} else {
    if ($action == 'setnote' && $user->rights->propale->creer) {
        $object->fetch($id);
        $result = $object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
        if ($result < 0) {
            dol_print_error($db, $object->error);
        }
    }
}
/******************************************************************************/
/* Affichage fiche                                                            */
コード例 #22
0
ファイル: commande.class.php プロジェクト: ripasch/dolibarr
 /**
  *        \brief      Classe la commande comme facturee
  *        \return     int     <0 si ko, >0 si ok
  */
 function classer_facturee()
 {
     global $conf;
     $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'commande SET facture = 1';
     $sql .= ' WHERE rowid = ' . $this->id . ' AND fk_statut > 0 ;';
     if ($this->db->query($sql)) {
         if ($conf->global->PROPALE_CLASSIFIED_INVOICED_WITH_ORDER == 1 && $this->propale_id) {
             $propal = new Propal($this->db);
             $propal->fetch($this->propale_id);
             $propal->classer_facturee();
         }
         return 1;
     } else {
         dol_print_error($this->db);
         return -1;
     }
 }
コード例 #23
0
ファイル: info.php プロジェクト: Samara94/dolibarr
 *      \brief      Page d'affichage des infos d'une proposition commerciale
 */
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
$langs->load('propal');
$langs->load('compta');
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
// Security check
if (!empty($user->societe_id)) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'propal', $id);
/*
 *	View
 */
llxHeader('', $langs->trans('Proposal'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
$object = new Propal($db);
$object->fetch($id);
$object->fetch_thirdparty();
$head = propal_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal');
$object->info($object->id);
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
llxFooter();
$db->close();
コード例 #24
0
ファイル: card.php プロジェクト: NoisyBoy86/Dolibarr_test
 $formmail->withdeliveryreceipt = 1;
 $formmail->withcancel = 1;
 // Tableau des substitutions
 $formmail->substit['__SHIPPINGREF__'] = $object->ref;
 $formmail->substit['__SIGNATURE__'] = $user->signature;
 $formmail->substit['__PERSONALIZED__'] = '';
 $formmail->substit['__CONTACTCIVNAME__'] = '';
 //Find the good contact adress
 //Find the good contact adress
 if ($typeobject == 'commande' && $object->{$typeobject}->id && !empty($conf->commande->enabled)) {
     $objectsrc = new Commande($db);
     $objectsrc->fetch($object->{$typeobject}->id);
 }
 if ($typeobject == 'propal' && $object->{$typeobject}->id && !empty($conf->propal->enabled)) {
     $objectsrc = new Propal($db);
     $objectsrc->fetch($object->{$typeobject}->id);
 }
 $custcontact = '';
 $contactarr = array();
 $contactarr = $objectsrc->liste_contact(-1, 'external');
 if (is_array($contactarr) && count($contactarr) > 0) {
     foreach ($contactarr as $contact) {
         if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) {
             require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
             $contactstatic = new Contact($db);
             $contactstatic->fetch($contact['id']);
             $custcontact = $contactstatic->getFullName($langs, 1);
         }
     }
     if (!empty($custcontact)) {
         $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
コード例 #25
0
ファイル: modules_propale.php プロジェクト: netors/dolibarr
/**
 *  Delete preview files
 * 	@param	    db  		objet base de donnee
 * 	@param	    propalid	id de la propal a effacer
 * 	@param      propalref   reference de la propal si besoin
 */
function propale_delete_preview($db, $propalid, $propalref = '')
{
    global $langs, $conf;
    require_once DOL_DOCUMENT_ROOT . "/lib/files.lib.php";
    if (!$propalref) {
        $propal = new Propal($db, "", $propalid);
        $propal->fetch($propalid);
        $propalref = $propal->ref;
    }
    if ($conf->propale->dir_output) {
        $propalref = dol_sanitizeFileName($propalref);
        $dir = $conf->propale->dir_output . "/" . $propalref;
        $file = $dir . "/" . $propalref . ".pdf.png";
        $multiple = $file . ".";
        if (file_exists($file) && is_writable($file)) {
            if (!dol_delete_file($file, 1)) {
                $this->error = $langs->trans("ErrorFailedToOpenFile", $file);
                return 0;
            }
        } else {
            for ($i = 0; $i < 20; $i++) {
                $preview = $multiple . $i;
                if (file_exists($preview) && is_writable($preview)) {
                    if (!unlink($preview)) {
                        $this->error = $langs->trans("ErrorFailedToOpenFile", $preview);
                        return 0;
                    }
                }
            }
        }
    }
    return 1;
}
コード例 #26
0
ファイル: fiche.php プロジェクト: remyyounes/dolibarr
			// Document origine
			if ($typeobject == 'commande' && $expedition->origin_id && $conf->commande->enabled)
			{
				print '<tr><td>'.$langs->trans("RefOrder").'</td>';
				$order=new Commande($db);
				$order->fetch($expedition->origin_id);
				print '<td colspan="3">';
				print $order->getNomUrl(1,'commande');
				print "</td>\n";
				print '</tr>';
			}
			if ($typeobject == 'propal' && $expedition->origin_id && $conf->propal->enabled)
			{
				$propal=new Propal($db);
				$propal->fetch($expedition->origin_id);
				print '<tr><td>'.$langs->trans("RefProposal").'</td>';
				print '<td colspan="3">';
				print $propal->getNomUrl(1,'expedition');
				print "</td>\n";
				print '</tr>';
			}

			// Ref client
			print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
			print '<td colspan="3">'.$delivery->ref_customer."</a></td>\n";
			print '</tr>';

			// Date
			print '<tr><td>'.$langs->trans("DateCreation").'</td>';
			print '<td colspan="3">'.dol_print_date($delivery->date_creation,'daytext')."</td>\n";
コード例 #27
0
ファイル: fiche.php プロジェクト: nrjacker4/crm-php
 // Project
 if (!empty($conf->projet->enabled)) {
     // Projet associe
     $langs->load("project");
     print '<tr><td valign="top">' . $langs->trans("Project") . '</td><td>';
     $numproject = select_projects(!empty($societe->id) ? $societe->id : 0, GETPOST("projectid") ? GETPOST("projectid") : '', 'projectid');
     if ($numproject == 0) {
         print ' &nbsp; <a href="' . DOL_DOCUMENT_ROOT . '/projet/fiche.php?socid=' . $societe->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
     }
     print '</td></tr>';
 }
 // PropalID
 if (GETPOST("propalid")) {
     // Object linked
     $propal = new Propal($db);
     $propal->fetch(GETPOST("propalid"));
     print '<tr><td valign="top">' . $langs->trans("LinkedObject") . '</td><td>';
     print '<input type="hidden" name="propalid" value="' . $propal->id . '">';
     print $propal->getNomUrl(1);
     print '</td></tr>';
 }
 if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) {
     $actioncomm->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]);
 }
 // Priority
 print '<tr><td nowrap>' . $langs->trans("Priority") . '</td><td colspan="3">';
 print '<input type="text" name="priority" value="' . (GETPOST('priority') ? GETPOST('priority') : ($actioncomm->priority ? $actioncomm->priority : '')) . '" size="5">';
 print '</td></tr>';
 add_row_for_calendar_link();
 // Description
 print '<tr><td valign="top">' . $langs->trans("Description") . '</td><td>';