Esempio n. 1
0
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 Propal($db);
$object->fetch($id, $ref);
if ($object->id > 0) {
    $object->fetch_thirdparty();
}
/*
 * Actions
 */
// Envoi fichier
if (GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    if ($object->id > 0) {
        $object->fetch_thirdparty();
        $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
        if (dol_mkdir($upload_dir) >= 0) {
            $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']);
            if (is_numeric($resupload) && $resupload > 0) {
                if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) {
                    // Create small thumbs for image (Ratio is near 16/9)
                    // Used on logon for example
Esempio n. 2
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
/*
 * Actions
		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();
        if (!empty($conf->global->PROPALAUTOSEND_JOIN_PDF)) {