Exemple #1
0
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/comm/askpricesupplier/class/askpricesupplier.class.php';
$langs->load("askpricesupplier");
$langs->load("companies");
// Security check
$socid = GETPOST('socid', 'int');
if (isset($user->societe_id) && $user->societe_id > 0) {
    $action = '';
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'askpricesupplier');
/*
 * View
 */
$now = dol_now();
$askpricesupplierstatic = new AskPriceSupplier($db);
$companystatic = new Societe($db);
$form = new Form($db);
$formfile = new FormFile($db);
$help_url = "EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur";
llxHeader("", $langs->trans("AskPriceSupplierArea"), $help_url);
print_fiche_titre($langs->trans("AskPriceSupplierArea"));
print '<div class="fichecenter"><div class="fichethirdleft">';
/*
 * Search form
 */
$var = false;
print '<form method="post" action="' . DOL_URL_ROOT . '/comm/askpricesupplier/list.php">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">' . $langs->trans("SearchRequest") . '</td></tr>';
Exemple #2
0
if ($search_sale > 0) {
    $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND c.fk_c_type_contact = tc.rowid AND tc.element='askpricesupplier' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = " . $search_user;
}
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ', p.ref DESC';
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
    $result = $db->query($sql);
    $nbtotalofrecords = $db->num_rows($result);
}
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result) {
    $objectstatic = new AskPriceSupplier($db);
    $userstatic = new User($db);
    $num = $db->num_rows($result);
    if ($socid) {
        $soc = new Societe($db);
        $soc->fetch($socid);
    }
    $param = '&socid=' . $socid . '&viewstatut=' . $viewstatut;
    if ($month) {
        $param .= '&month=' . $month;
    }
    if ($year) {
        $param .= '&year=' . $year;
    }
    if ($search_ref) {
        $param .= '&search_ref=' . $search_ref;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if ($page == -1) {
    $page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
    $sortorder = "ASC";
}
if (!$sortfield) {
    $sortfield = "name";
}
$object = new AskPriceSupplier($db);
$object->fetch($id, $ref);
if ($object->id > 0) {
    $object->fetch_thirdparty();
    $upload_dir = $conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($object->ref);
    include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
}
/*
 * View
 */
llxHeader('', $langs->trans('CommRequest'), 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
$form = new Form($db);
if ($object->id > 0) {
    $upload_dir = $conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($object->ref);
    $head = askpricesupplier_prepare_head($object);
    dol_fiche_head($head, 'document', $langs->trans('CommRequest'), 0, 'askpricesupplier');
/**
 *  Create a document onto disk according to template module.
 *
 * 	@param	    DoliDB		$db  			Database handler
 * 	@param	    AskPriceSupplier		$object			Object askpricesupplier
 * 	@param	    string		$modele			Force model to use ('' to not force)
 * 	@param		Translate	$outputlangs	Object langs to use for output
 *  @param      int			$hidedetails    Hide details of lines
 *  @param      int			$hidedesc       Hide description
 *  @param      int			$hideref        Hide ref
 * 	@return     int         				0 if KO, 1 if OK
 * @deprecated Use the new function generateDocument of AskPriceSupplier class
 * @see AskPriceSupplier::generateDocument()
 */
function askpricesupplier_pdf_create(DoliDB $db, AskPriceSupplier $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
    dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
    return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
Exemple #5
0
 */
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/comm/askpricesupplier/class/askpricesupplier.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/askpricesupplier.lib.php';
$langs->load('askpricesupplier');
$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, 'askpricesupplier', $id, 'askpricesupplier');
$object = new AskPriceSupplier($db);
/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/
$permissionnote = $user->rights->askpricesupplier->creer;
// Used by the include of actions_setnotes.inc.php
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';
// Must be include, not includ_once
/******************************************************************************/
/* Affichage fiche                                                            */
/******************************************************************************/
llxHeader('', $langs->trans('CommRequest'), 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
$form = new Form($db);
if ($id > 0 || !empty($ref)) {
    if ($mesg) {
        print $mesg;
Exemple #6
0
$originid = GETPOST('originid', 'int');
$confirm = GETPOST('confirm', 'alpha');
$lineid = GETPOST('lineid', 'int');
$contactid = GETPOST('contactid', 'int');
// PDF
$hidedetails = GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
$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, 'askpricesupplier', $id);
$object = new AskPriceSupplier($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('askpricesuppliercard', 'globalcard'));
 } elseif ($tmp == 'NotConfigured') {
     print $langs->trans($tmp);
 } else {
     print $tmp;
 }
 print '</td>' . "\n";
 print '<td align="center">';
 if ($conf->global->ASKPRICESUPPLIER_ADDON == "{$file}") {
     print img_picto($langs->trans("Activated"), 'switch_on');
 } else {
     print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=' . $file . '">';
     print img_picto($langs->trans("Disabled"), 'switch_off');
     print '</a>';
 }
 print '</td>';
 $askpricesupplier = new AskPriceSupplier($db);
 $askpricesupplier->initAsSpecimen();
 // Info
 $htmltooltip = '';
 $htmltooltip .= '' . $langs->trans("Version") . ': <b>' . $module->getVersion() . '</b><br>';
 $nextval = $module->getNextValue($mysoc, $askpricesupplier);
 if ("{$nextval}" != $langs->trans("NotAvailable")) {
     // Keep " on nextval
     $htmltooltip .= '' . $langs->trans("NextValue") . ': ';
     if ($nextval) {
         if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
             $nextval = $langs->trans($nextval);
         }
         $htmltooltip .= $nextval . '<br>';
     } else {
         $htmltooltip .= $langs->trans($module->error) . '<br>';