function _exitOrNot(&$object, $className)
{
    if ($object->statut != $className::STATUS_DRAFT) {
        setEventMessages($langs->trans('arronditotalErrorObjectNotDraft'), null, 'errors');
        exit;
    }
    if ($object->element == 'facture') {
        if ($object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_SITUATION) {
            setEventMessages($langs->trans('arronditotalErrorTypeInvoice'), null, 'errors');
            exit;
        }
    }
}
示例#2
0
             $classname = "pdf_" . $modele;
             break;
         }
     }
     if ($filefound) {
         require_once $file;
         $module = new $classname($db, $commande);
         if ($module->write_file($commande, $langs) > 0) {
             header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
             return;
         } else {
             setEventMessages($module->error, $module->errors, 'errors');
             dol_syslog($module->error, LOG_ERR);
         }
     } else {
         setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
         dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
     }
 } else {
     if ($action == 'set') {
         $ret = addDocumentModel($value, $type, $label, $scandir);
     } else {
         if ($action == 'del') {
             $ret = delDocumentModel($value, $type);
             if ($ret > 0) {
                 if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "{$value}") {
                     dolibarr_del_const($db, 'COMMANDE_SUPPLIER_ADDON_PDF', $conf->entity);
                 }
             }
         } else {
             if ($action == 'setdoc') {
示例#3
0
 /**
  * Fill array_options property of object by extrafields value (using for data sent by forms)
  *
  * @param   array	$extralabels    $array of extrafields
  * @param   object	$object         Object
  * @param	string	$onlykey		Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset.
  * @return	int						1 if array_options set, 0 if no value, -1 if error (field required missing for example)
  */
 function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
 {
     global $_POST, $langs;
     $nofillrequired = '';
     // For error when required field left blank
     $error_field_required = array();
     if (is_array($extralabels)) {
         // Get extra fields
         foreach ($extralabels as $key => $value) {
             if (!empty($onlykey) && $key != $onlykey) {
                 continue;
             }
             $key_type = $this->attribute_type[$key];
             if ($this->attribute_required[$key] && !GETPOST("options_{$key}", 2)) {
                 $nofillrequired++;
                 $error_field_required[] = $value;
             }
             if (in_array($key_type, array('date', 'datetime'))) {
                 // Clean parameters
                 $value_key = dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]);
             } else {
                 if (in_array($key_type, array('checkbox', 'chkbxlst'))) {
                     $value_arr = GETPOST("options_" . $key);
                     if (!empty($value_arr)) {
                         $value_key = implode($value_arr, ',');
                     } else {
                         $value_key = '';
                     }
                 } else {
                     if (in_array($key_type, array('price', 'double'))) {
                         $value_arr = GETPOST("options_" . $key);
                         $value_key = price2num($value_arr);
                     } else {
                         $value_key = GETPOST("options_" . $key);
                     }
                 }
             }
             $object->array_options["options_" . $key] = $value_key;
         }
         if ($nofillrequired) {
             $langs->load('errors');
             setEventMessages($langs->trans('ErrorFieldsRequired') . ' : ' . implode(', ', $error_field_required), null, 'errors');
             return -1;
         } else {
             return 1;
         }
     } else {
         return 0;
     }
 }
示例#4
0
    $viewstatut = '';
    $object_statut = '';
}
if ($object_statut != '') {
    $viewstatut = $object_statut;
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propallist'));
/*
 * Actions
 */
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
/*
 * View
 */
llxHeader('', $langs->trans('Proposal'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$formpropal = new FormPropal($db);
$companystatic = new Societe($db);
$now = dol_now();
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if ($page == -1) {
示例#5
0
        if ($constvalue) {
            $constvalue = 0;
        } else {
            $constvalue = 1;
        }
    }
    $consttype = GETPOST('consttype', 'alpha');
    $constnote = GETPOST('constnote');
    $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
    if (!$res > 0) {
        $error++;
    }
    if (!$error) {
        setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
    } else {
        setEventMessages($langs->trans("Error"), null, 'errors');
    }
}
// Action activation d'un sous module du module adherent
if ($action == 'set') {
    $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
    if ($result < 0) {
        print $db->error();
    }
}
// Action desactivation d'un sous module du module adherent
if ($action == 'unset') {
    $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
    if ($result < 0) {
        print $db->error();
    }
示例#6
0
             break;
         case 'Contrat':
             $newclassname = 'Contract';
             break;
         case 'Fichinter':
             $newclassname = 'Intervention';
             break;
         default:
             $newclassname = $classname;
     }
     print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
     // We check if Origin document (id and type is known) has already at least one invoice attached to it
     $objectsrc->fetchObjectLinked($originid, $origin, '', 'facture');
     $cntinvoice = count($objectsrc->linkedObjects['facture']);
     if ($cntinvoice >= 1) {
         setEventMessages('WarningBillExist', null, 'warnings');
         echo ' (' . $langs->trans('LatestRelatedBill') . end($objectsrc->linkedObjects['facture'])->getNomUrl(1) . ')';
     }
     echo '</td></tr>';
     print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
     print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
     if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) {
         print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1) . "</td></tr>";
     }
     if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) {
         print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
     }
     print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
 } else {
     // Show deprecated optional form to add product line here
     if (!empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) {
示例#7
0
}
if ($mode == 'test' && $user->admin) {
    dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
    print $langs->trans('PrintTestDesc' . $driver) . "<br><br>\n";
    print '<table class="noborder" width="100%">';
    if (!empty($driver)) {
        require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/' . $driver . '.modules.php';
        $classname = 'printing_' . $driver;
        $langs->load($driver);
        $printer = new $classname($db);
        //print '<pre>'.print_r($printer, true).'</pre>';
        if (count($printer->getlist_available_printers())) {
            if ($printer->listAvailablePrinters() == 0) {
                print $printer->resprint;
            } else {
                setEventMessages($printer->error, $printer->errors, 'errors');
            }
        } else {
            print $langs->trans('PleaseConfigureDriverfromList');
        }
    } else {
        print $langs->trans('PleaseSelectaDriverfromList');
    }
    print '</table>';
    dol_fiche_end();
}
if ($mode == 'userconf' && $user->admin) {
    dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
    print $langs->trans('PrintUserConfDesc' . $driver) . "<br><br>\n";
    print '<table class="noborder" width="100%">';
    $var = true;
示例#8
0
        $sql1 .= " AND fd.fk_code_ventilation = 0";
    } else {
        $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
        $sql1 .= " SET fd.fk_code_ventilation = accnt.rowid";
        $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
        $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
        $sql1 .= " AND fd.fk_code_ventilation = 0";
    }
    $resql1 = $db->query($sql1);
    if (!$resql1) {
        $error++;
        $db->rollback();
        setEventMessages($db->lasterror(), null, 'errors');
    } else {
        $db->commit();
        setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
    }
} elseif ($action == 'fixaccountancycode') {
    $error = 0;
    $db->begin();
    $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
    $sql1 .= " SET fd.fk_code_ventilation = 0";
    $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
    $sql1 .= '	(SELECT accnt.rowid ';
    $sql1 .= '	FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
    $sql1 .= '	INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
    $sql1 .= '	ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
    dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
    $resql1 = $db->query($sql1);
    if (!$resql1) {
        $error++;
示例#9
0
                        $choixdate .= ",";
                        $choixdate .= $_SESSION["totalchoixjour"][$i];
                        $choixdate .= "@";
                        // On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite
                        $choixdate .= str_replace(array(',', '@'), array('&#44;', '&#64;'), $_SESSION["horaires{$i}"][$j]);
                    }
                }
            }
        }
        if (isset($errheure)) {
            setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors');
        }
    }
    //If just one day and no other time options, error message
    if (count($_SESSION["totalchoixjour"]) == "1" && $_POST["horaires0"][0] == "" && $_POST["horaires0"][1] == "" && $_POST["horaires0"][2] == "" && $_POST["horaires0"][3] == "" && $_POST["horaires0"][4] == "") {
        setEventMessages($langs->trans("MoreChoices"), null, 'errors');
        $erreur = true;
    }
    // Add survey into database
    if (!$erreur) {
        $_SESSION["toutchoix"] = substr("{$choixdate}", 1);
        ajouter_sondage();
    }
}
// Reset days
if (GETPOST('reset')) {
    $nbofchoice = count($_SESSION["totalchoixjour"]);
    for ($i = 0; $i < $nbofchoice; $i++) {
        for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
            unset($_SESSION["horaires{$i}"][$j]);
        }
示例#10
0
            }
            if ($result >= 0) {
                $db->commit();
                header("Location: " . DOL_URL_ROOT . '/compta/tva/reglement.php');
                exit;
            } else {
                $tva->error = $accountline->error;
                $db->rollback();
                setEventMessages($tva->error, $tva->errors, 'errors');
            }
        } else {
            $db->rollback();
            setEventMessages($tva->error, $tva->errors, 'errors');
        }
    } else {
        setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
    }
}
/*
 *	View
 */
llxHeader();
$form = new Form($db);
if ($id) {
    $vatpayment = new Tva($db);
    $result = $vatpayment->fetch($id);
    if ($result <= 0) {
        dol_print_error($db);
        exit;
    }
}
示例#11
0
        // Do not use urldecode here ($_GET and $_POST are already decoded by PHP).
        $ret = dol_delete_file($file);
        if ($ret) {
            setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
        } else {
            setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
        }
        $result = $ecmdir->changeNbOfFiles('-');
        clearstatcache();
    }
    $action = 'file_manager';
}
// Remove directory
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') {
    $result = $ecmdir->delete($user);
    setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
    clearstatcache();
}
// Refresh directory view
if ($action == 'refreshmanual') {
    $ecmdirtmp = new EcmDirectory($db);
    // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate
    clearstatcache();
    $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output);
    $diroutputslash .= '/';
    // Scan directory tree on disk
    $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0);
    // Scan directory tree in database
    $sqltree = $ecmdirstatic->get_full_arbo(0);
    $adirwascreated = 0;
    // Now we compare both trees to complete missing trees into database
示例#12
0
            } else {
                $d_eatby = dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
                $d_sellby = dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
                $pdluo->batch = GETPOST("batch_number", 'san_alpha');
                $pdluo->eatby = $d_eatby;
                $pdluo->sellby = $d_sellby;
                $result = $pdluo->update($user);
                if ($result < 0) {
                    setEventMessages($pdluo->error, $pdluo->errors, 'errors');
                }
            }
        } else {
            setEventMessages($langs->trans('BatchInformationNotfound'), null, 'errors');
        }
    } else {
        setEventMessages($pdluo->error, null, 'errors');
    }
    header("Location: product.php?id=" . $id);
    exit;
}
/*
 * View
 */
$formproduct = new FormProduct($db);
if ($id > 0 || $ref) {
    $product = new Product($db);
    $result = $product->fetch($id, $ref);
    $product->load_stock();
    $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
    llxHeader("", $langs->trans("CardProduct" . $product->type), $help_url);
    if ($result > 0) {
示例#13
0
        $i = 1;
        while ($menu = $db->fetch_array($res)) {
            if (!empty($menu['langs'])) {
                $langs->load($menu['langs']);
            }
            $titre = $langs->trans($menu['titre']);
            $data[] = array('rowid' => $menu['rowid'], 'fk_menu' => $menu['fk_menu'], 'title' => $titre, 'mainmenu' => $menu['mainmenu'], 'leftmenu' => $menu['leftmenu'], 'fk_mainmenu' => $menu['fk_mainmenu'], 'fk_leftmenu' => $menu['fk_leftmenu'], 'entry' => '<table class="nobordernopadding centpercent"><tr><td>' . '<strong> &nbsp; <a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=edit&menuId=' . $menu['rowid'] . '">' . $titre . '</a></strong>' . '</td><td align="right">' . '<a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=edit&menuId=' . $menu['rowid'] . '">' . img_edit('default', 0, 'class="menuEdit" id="edit' . $menu['rowid'] . '"') . '</a> ' . '<a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=create&menuId=' . $menu['rowid'] . '">' . img_edit_add('default') . '</a> ' . '<a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=delete&menuId=' . $menu['rowid'] . '">' . img_delete('default') . '</a> ' . '&nbsp; &nbsp; &nbsp;' . '<a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=up&menuId=' . $menu['rowid'] . '">' . img_picto("Monter", "1uparrow") . '</a><a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=down&menuId=' . $menu['rowid'] . '">' . img_picto("Descendre", "1downarrow") . '</a>' . '</td></tr></table>');
            $i++;
        }
    }
    // Appelle de la fonction recursive (ammorce)
    // avec recherche depuis la racine.
    //var_dump($data);
    tree_recur($data, $data[0], 0);
    print '</td>';
    print '</tr>';
    print '</table>';
    print '</div>';
    /*
     * Boutons actions
     */
    print '<div class="tabsAction">';
    print '<a class="butAction" href="' . DOL_URL_ROOT . '/admin/menus/edit.php?menuId=0&amp;action=create&amp;menu_handler=' . urlencode($menu_handler) . '">' . $langs->trans("NewMenu") . '</a>';
    print '</div>';
} else {
    $langs->load("errors");
    setEventMessages($langs->trans("ErrorFeatureNeedJavascript"), null, 'errors');
}
print '<br>';
llxFooter();
$db->close();
示例#14
0
                        $nextvalue = $modBarCodeProduct->getNextValue($productstatic, '');
                        //print 'Set value '.$nextvalue.' to product '.$productstatic->id." ".$productstatic->ref." ".$productstatic->type."<br>\n";
                        $result = $productstatic->setValueFrom('barcode', $nextvalue);
                        $nbtry++;
                        if ($result > 0) {
                            $nbok++;
                        }
                    }
                    $i++;
                }
            } else {
                $error++;
                dol_print_error($db);
            }
            if (!$error) {
                setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
            }
        }
        if (!$error) {
            //$db->rollback();
            $db->commit();
        } else {
            $db->rollback();
        }
    }
    $action = '';
}
/*
 * View
 */
if (!$user->admin) {
示例#15
0
 if (!$error) {
     // Create payment line for invoice
     $paiement_id = $paiement->create($user);
     if (!$paiement_id > 0) {
         $errmsg = $paiement->error;
         $errmsgs = $paiement->errors;
         $error++;
     }
 }
 if (!$error) {
     // Add transaction into bank account
     $bank_line_id = $paiement->addPaymentToBank($user, 'payment', '(SubscriptionPayment)', $accountid, $emetteur_nom, $emetteur_banque);
     if (!($bank_line_id > 0)) {
         $errmsg = $paiement->error;
         $errmsgs = $paiement->errors;
         setEventMessages($paiement->error, $paiement->errors, 'errors');
         $error++;
     }
 }
 if (!$error) {
     // Update fk_bank into subscription table
     $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'cotisation SET fk_bank=' . $bank_line_id;
     $sql .= ' WHERE rowid=' . $crowid;
     $result = $db->query($sql);
     if (!$result) {
         $error++;
     }
 }
 if (!$error) {
     // Set invoice as paid
     $invoice->set_paid($user);
示例#16
0
         // May be phpbarcode
         $template = 'standardlabel';
         $is2d = false;
         if ($module->encodingIsSupported($encoding)) {
             $barcodeimage = $conf->barcode->dir_temp . '/barcode_' . $code . '_' . $encoding . '.png';
             dol_delete_file($barcodeimage);
             // File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
             $result = $module->writeBarCode($code, $encoding, 'Y', 4, 1);
             if ($result <= 0 || !dol_is_file($barcodeimage)) {
                 $error++;
                 setEventMessages('Failed to generate image file of barcode for code=' . $code . ' encoding=' . $encoding . ' file=' . basename($barcodeimage), null, 'errors');
                 setEventMessages($module->error, null, 'errors');
             }
         } else {
             $error++;
             setEventMessages("Error, encoding " . $encoding . " is not supported by encoder " . $generator . '. You must choose another barcode type or install a barcode generation engine that support ' . $encoding, null, 'errors');
         }
     } else {
         $template = 'tcpdflabel';
         $encoding = $module->getTcpdfEncodingType($encoding);
         //convert to TCPDF compatible encoding types
         $is2d = $module->is2d;
     }
 }
 if (!$error) {
     // List of values to scan for a replacement
     $substitutionarray = array('%LOGIN%' => $user->login, '%COMPANY%' => $mysoc->name, '%ADDRESS%' => $mysoc->address, '%ZIP%' => $mysoc->zip, '%TOWN%' => $mysoc->town, '%COUNTRY%' => $mysoc->country, '%COUNTRY_CODE%' => $mysoc->country_code, '%EMAIL%' => $mysoc->email, '%YEAR%' => $year, '%MONTH%' => $month, '%DAY%' => $day, '%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT, '%SERVER%' => "http://" . $_SERVER["SERVER_NAME"] . "/");
     complete_substitutions_array($substitutionarray, $langs);
     // For labels
     if ($mode == 'label') {
         $txtforsticker = "%PHOTO%";
示例#17
0
if (!empty($_GET["month"])) {
    $month = sprintf("%02d", $_GET["month"]);
}
$acct = new Account($db);
if ($_GET["account"] && !preg_match('/,/', $_GET["account"])) {
    $result = $acct->fetch($_GET["account"]);
}
if ($_GET["ref"]) {
    $result = $acct->fetch(0, $_GET["ref"]);
    $account = $acct->id;
}
$result = dol_mkdir($conf->banque->dir_temp);
if ($result < 0) {
    $langs->load("errors");
    $error++;
    setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
} else {
    // Calcul $min and $max
    $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
    $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
    $sql .= ", " . MAIN_DB_PREFIX . "bank_account as ba";
    $sql .= " WHERE b.fk_account = ba.rowid";
    $sql .= " AND ba.entity IN (" . getEntity('bank_account', 1) . ")";
    if ($account && $_GET["option"] != 'all') {
        $sql .= " AND b.fk_account IN (" . $account . ")";
    }
    $resql = $db->query($sql);
    if ($resql) {
        $num = $db->num_rows($resql);
        $obj = $db->fetch_object($resql);
        $min = $db->jdate($obj->min);
示例#18
0
 }
 if (empty($ref_fourn)) {
     $error++;
     $langs->load("errors");
     setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefSupplier")), null, 'errors');
 }
 if ($id_fourn <= 0) {
     $error++;
     $langs->load("errors");
     setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Supplier")), null, 'errors');
 }
 if ($_POST["price"] < 0 || $_POST["price"] == '') {
     if ($price_expression === '') {
         $error++;
         $langs->load("errors");
         setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")), null, 'errors');
     } else {
         $_POST["price"] = 0;
     }
 }
 if (!$error) {
     $db->begin();
     if (!$error) {
         $ret = $object->add_fournisseur($user, $id_fourn, $ref_fourn, $quantity);
         // This insert record with no value for price. Values are update later with update_buyprice
         if ($ret == -3) {
             $error++;
             $object->fetch($object->product_id_already_linked);
             $productLink = $object->getNomUrl(1, 'supplier');
             setEventMessage($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", $productLink), 'errors');
         } else {
示例#19
0
/**
 * Show event of a particular day for a user
 *
 * @param	string	$username		Login
 * @param   int		$day            Day
 * @param   int		$month          Month
 * @param   int		$year           Year
 * @param   int		$monthshown     Current month shown in calendar view
 * @param   string	$style          Style to use for this day
 * @param   array	$eventarray    	Array of events
 * @param   int		$maxprint       Nb of actions to show each day on month view (0 means no limit)
 * @param   int		$maxnbofchar    Nb of characters to show for event line
 * @param   string	$newparam       Parameters on current URL
 * @param   int		$showinfo       Add extended information (used by day view)
 * @param   int		$minheight      Minimum height for each event. 60px by default.
 * @param	boolean	$showheader		Show header
 * @param	array	$colorsbytype	Array with colors by type
 * @param	bool	$var			true or false for alternat style on tr/td
 * @return	void
 */
function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $showheader = false, $colorsbytype = array(), $var = false)
{
    global $db;
    global $user, $conf, $langs, $hookmanager, $action;
    global $filter, $filtert, $status, $actioncode;
    // Filters used into search form
    global $theme_datacolor;
    // Array with a list of different we can use (come from theme)
    global $cachethirdparties, $cachecontacts, $colorindexused;
    global $begin_h, $end_h;
    $cases1 = array();
    // Color first half hour
    $cases2 = array();
    // Color second half hour
    $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
    $i = 0;
    $nummytasks = 0;
    $numother = 0;
    $numbirthday = 0;
    $numical = 0;
    $numicals = array();
    $ymd = sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day);
    $nextindextouse = count($colorindexused);
    // At first run, this is 0, so fist user has 0, next 1, ...
    //if ($username->id && $day==1) var_dump($eventarray);
    // We are in a particular day for $username, now we scan all events
    foreach ($eventarray as $daykey => $notused) {
        $annee = date('Y', $daykey);
        $mois = date('m', $daykey);
        $jour = date('d', $daykey);
        //print $annee.'-'.$mois.'-'.$jour.' '.$year.'-'.$month.'-'.$day."<br>\n";
        if ($day == $jour && $month == $mois && $year == $annee) {
            // Scan all event for this date
            foreach ($eventarray[$daykey] as $index => $event) {
                $keysofuserassigned = array_keys($event->userassigned);
                if (!in_array($username->id, $keysofuserassigned)) {
                    continue;
                }
                // We discard record if event is from another user than user we want to show
                //if ($username->id != $event->userownerid) continue;	// We discard record if event is from another user than user we want to show
                $parameters = array();
                $reshook = $hookmanager->executeHooks('formatEvent', $parameters, $event, $action);
                // Note that $action and $object may have been modified by some hooks
                if ($reshook < 0) {
                    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
                }
                $ponct = $event->date_start_in_calendar == $event->date_end_in_calendar;
                // Define $color (Hex string like '0088FF') and $cssclass of event
                $color = -1;
                $cssclass = '';
                $colorindex = -1;
                if (in_array($user->id, $keysofuserassigned)) {
                    $nummytasks++;
                    $cssclass = 'family_mytasks';
                    if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
                        $color = $event->type_color;
                    }
                } else {
                    if ($event->type_code == 'ICALEVENT') {
                        $numical++;
                        if (!empty($event->icalname)) {
                            if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
                                $numicals[dol_string_nospecial($event->icalname)] = 0;
                            }
                            $numicals[dol_string_nospecial($event->icalname)]++;
                        }
                        $color = $event->icalcolor;
                        $cssclass = !empty($event->icalname) ? 'family_ext' . md5($event->icalname) : 'family_other unsortable';
                    } else {
                        if ($event->type_code == 'BIRTHDAY') {
                            $numbirthday++;
                            $colorindex = 2;
                            $cssclass = 'family_birthday unsortable';
                            $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
                        } else {
                            $numother++;
                            $cssclass = 'family_other';
                            if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
                                $color = $event->type_color;
                            }
                        }
                    }
                }
                if ($color < 0) {
                    // Define color index if not yet defined
                    $idusertouse = $event->userownerid ? $event->userownerid : 0;
                    if (isset($colorindexused[$idusertouse])) {
                        $colorindex = $colorindexused[$idusertouse];
                        // Color already assigned to this user
                    } else {
                        $colorindex = $nextindextouse;
                        $colorindexused[$idusertouse] = $colorindex;
                        if (!empty($theme_datacolor[$nextindextouse + 1])) {
                            $nextindextouse++;
                        }
                        // Prepare to use next color
                    }
                    // Define color
                    $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
                }
                //$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
                // Define all rects with event (cases1 is first half hour, cases2 is second half hour)
                for ($h = $begin_h; $h < $end_h; $h++) {
                    //if ($username->id == 1 && $day==1) print 'h='.$h;
                    $newcolor = '';
                    //init
                    if (empty($event->fulldayevent)) {
                        $a = dol_mktime((int) $h, 0, 0, $month, $day, $year, false, false);
                        $b = dol_mktime((int) $h, 30, 0, $month, $day, $year, false, false);
                        $c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, false, false);
                        $dateendtouse = $event->date_end_in_calendar;
                        if ($dateendtouse == $event->date_start_in_calendar) {
                            $dateendtouse++;
                        }
                        //print dol_print_date($event->date_start_in_calendar,'dayhour').'-'.dol_print_date($a,'dayhour').'-'.dol_print_date($b,'dayhour').'<br>';
                        if ($event->date_start_in_calendar < $b && $dateendtouse > $a) {
                            $busy = $event->transparency;
                            $cases1[$h][$event->id]['busy'] = $busy;
                            $cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
                            if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
                                $tmpa = dol_getdate($event->date_start_in_calendar, true);
                                $tmpb = dol_getdate($event->date_end_in_calendar, true);
                                if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
                                    $cases1[$h][$event->id]['string'] .= '-' . dol_print_date($event->date_end_in_calendar, 'hour');
                                } else {
                                    $cases1[$h][$event->id]['string'] .= '-' . dol_print_date($event->date_end_in_calendar, 'dayhour');
                                }
                            }
                            $cases1[$h][$event->id]['string'] .= ' - ' . $event->label;
                            $cases1[$h][$event->id]['typecode'] = $event->type_code;
                            if ($event->socid) {
                                //$cases1[$h][$event->id]['string'].='xxx';
                            }
                            $cases1[$h][$event->id]['color'] = $color;
                        }
                        if ($event->date_start_in_calendar < $c && $dateendtouse > $b) {
                            $busy = $event->transparency;
                            $cases2[$h][$event->id]['busy'] = $busy;
                            $cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
                            if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
                                $tmpa = dol_getdate($event->date_start_in_calendar, true);
                                $tmpb = dol_getdate($event->date_end_in_calendar, true);
                                if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
                                    $cases2[$h][$event->id]['string'] .= '-' . dol_print_date($event->date_end_in_calendar, 'hour');
                                } else {
                                    $cases2[$h][$event->id]['string'] .= '-' . dol_print_date($event->date_end_in_calendar, 'dayhour');
                                }
                            }
                            $cases2[$h][$event->id]['string'] .= ' - ' . $event->label;
                            $cases2[$h][$event->id]['typecode'] = $event->type_code;
                            if ($event->socid) {
                                //$cases2[$h][$event->id]['string'].='xxx';
                            }
                            $cases2[$h][$event->id]['color'] = $color;
                        }
                    } else {
                        $busy = $event->transparency;
                        $cases1[$h][$event->id]['busy'] = $busy;
                        $cases2[$h][$event->id]['busy'] = $busy;
                        $cases1[$h][$event->id]['string'] = $event->label;
                        $cases2[$h][$event->id]['string'] = $event->label;
                        $cases1[$h][$event->id]['typecode'] = $event->type_code;
                        $cases2[$h][$event->id]['typecode'] = $event->type_code;
                        $cases1[$h][$event->id]['color'] = $color;
                        $cases2[$h][$event->id]['color'] = $color;
                    }
                }
                $i++;
            }
            break;
            // We found the date we were looking for. No need to search anymore.
        }
    }
    for ($h = $begin_h; $h < $end_h; $h++) {
        $color1 = '';
        $color2 = '';
        $style1 = '';
        $style2 = '';
        $string1 = '&nbsp;';
        $string2 = '&nbsp;';
        $title1 = '';
        $title2 = '';
        if (isset($cases1[$h]) && $cases1[$h] != '') {
            //$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
            if (count($cases1[$h]) > 1) {
                $title1 .= count($cases1[$h]) . ' ' . (count($cases1[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
            }
            $string1 = '&nbsp;';
            if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) {
                $style1 = 'peruser_notbusy';
            } else {
                $style1 = 'peruser_busy';
            }
            foreach ($cases1[$h] as $id => $ev) {
                if ($ev['busy']) {
                    $style1 = 'peruser_busy';
                }
            }
        }
        if (isset($cases2[$h]) && $cases2[$h] != '') {
            //$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
            if (count($cases2[$h]) > 1) {
                $title2 .= count($cases2[$h]) . ' ' . (count($cases2[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events"));
            }
            $string2 = '&nbsp;';
            if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) {
                $style2 = 'peruser_notbusy';
            } else {
                $style2 = 'peruser_busy';
            }
            foreach ($cases2[$h] as $id => $ev) {
                if ($ev['busy']) {
                    $style2 = 'peruser_busy';
                }
            }
        }
        if ($h == $begin_h) {
            echo '<td class="' . $style . '_peruserleft cal_peruser"' . ($var ? ' style="background: #F8F8F8"' : '') . '>';
        } else {
            echo '<td class="' . $style . ' cal_peruser"' . ($var ? ' style="background: #F8F8F8"' : '') . '>';
        }
        if (count($cases1[$h]) == 1) {
            $ids = array_keys($cases1[$h]);
            $output = array_slice($cases1[$h], 0, 1);
            if ($output[0]['string']) {
                $title1 .= ($title1 ? ' - ' : '') . $output[0]['string'];
            }
            if ($output[0]['color']) {
                $color1 = $output[0]['color'];
            }
        } else {
            if (count($cases1[$h]) > 1) {
                $color1 = '222222';
            }
        }
        if (count($cases2[$h]) == 1) {
            $ids = array_keys($cases2[$h]);
            $output = array_slice($cases2[$h], 0, 1);
            if ($output[0]['string']) {
                $title2 .= ($title2 ? ' - ' : '') . $output[0]['string'];
            }
            if ($output[0]['color']) {
                $color2 = $output[0]['color'];
            }
        } else {
            if (count($cases2[$h]) > 1) {
                $color2 = '222222';
            }
        }
        $ids1 = '';
        $ids2 = '';
        if (count($cases1[$h]) && array_keys($cases1[$h])) {
            $ids1 = join(',', array_keys($cases1[$h]));
        }
        if (count($cases2[$h]) && array_keys($cases2[$h])) {
            $ids2 = join(',', array_keys($cases2[$h]));
        }
        //var_dump($cases1[$h]);
        print '<table class="nobordernopadding" width="100%">';
        print '<tr><td ' . ($color1 ? 'style="background: #' . $color1 . ';"' : '') . 'class="' . ($style1 ? $style1 . ' ' : '') . 'onclickopenref' . ($title1 ? ' cursorpointer' : '') . '" ref="ref_' . $username->id . '_' . sprintf("%04d", $year) . '_' . sprintf("%02d", $month) . '_' . sprintf("%02d", $day) . '_' . sprintf("%02d", $h) . '_00_' . ($ids1 ? $ids1 : 'none') . '"' . ($title1 ? ' title="' . $title1 . '"' : '') . '>';
        print $string1;
        print '</td><td ' . ($color2 ? 'style="background: #' . $color2 . ';"' : '') . 'class="' . ($style2 ? $style2 . ' ' : '') . 'onclickopenref' . ($title1 ? ' cursorpointer' : '') . '" ref="ref_' . $username->id . '_' . sprintf("%04d", $year) . '_' . sprintf("%02d", $month) . '_' . sprintf("%02d", $day) . '_' . sprintf("%02d", $h) . '_30_' . ($ids2 ? $ids2 : 'none') . '"' . ($title2 ? ' title="' . $title2 . '"' : '') . '>';
        print $string2;
        print '</td></tr>';
        print '</table>';
        print '</td>';
    }
}
示例#20
0
 /**
  *      Update parameters of third party
  *
  *      @param  User	$user            			User executing update
  *      @param  int		$call_trigger    			0=no, 1=yes
  *      @return int  			           			<0 if KO, >=0 if OK
  */
 public function update($user = '', $call_trigger = 1)
 {
     global $langs, $conf;
     require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
     $langs->load("errors");
     $error = 0;
     dol_syslog(get_class($this) . "::Update id = " . $this->id . " call_trigger = " . $call_trigger);
     // Check parameters
     if (empty($this->url)) {
         $this->error = $langs->trans("NoURL");
         return -1;
     }
     // Clean parameters
     $this->url = clean_url($this->url, 1);
     if (empty($this->label)) {
         $this->label = basename($this->url);
     }
     $this->label = trim($this->label);
     $this->db->begin();
     $sql = "UPDATE " . MAIN_DB_PREFIX . "links SET ";
     $sql .= "entity = '" . $conf->entity . "'";
     $sql .= ", datea = '" . $this->db->idate(dol_now()) . "'";
     $sql .= ", url = '" . $this->db->escape($this->url) . "'";
     $sql .= ", label = '" . $this->db->escape($this->label) . "'";
     $sql .= ", objecttype = '" . $this->objecttype . "'";
     $sql .= ", objectid = " . $this->objectid;
     $sql .= " WHERE rowid = '" . $this->id . "'";
     dol_syslog(get_class($this) . "::update sql = " . $sql);
     $resql = $this->db->query($sql);
     if ($resql) {
         if ($call_trigger) {
             // Call trigger
             $result = $this->call_trigger('LINK_MODIFY', $user);
             if ($result < 0) {
                 $error++;
             }
             // End call triggers
         }
         if (!$error) {
             dol_syslog(get_class($this) . "::Update success");
             $this->db->commit();
             return 1;
         } else {
             setEventMessages('', $this->errors, 'errors');
             $this->db->rollback();
             return -1;
         }
     } else {
         if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
             // Doublon
             $this->error = $langs->trans("ErrorDuplicateField");
             $result = -1;
         } else {
             $this->error = $langs->trans("Error sql = " . $sql);
             $result = -2;
         }
         $this->db->rollback();
         return $result;
     }
 }
示例#21
0
}
if (GETPOST('actioncancel')) {
    //$_GET["id"]=GETPOST('id', 'int');       // Force affichage dictionnaire en cours d'edition
}
if ($action == 'confirm_delete' && $confirm == 'yes') {
    if ($tabrowid[$id]) {
        $rowidcol = $tabrowid[$id];
    } else {
        $rowidcol = "rowid";
    }
    $sql = "DELETE from " . $tabname[$id] . " WHERE " . $rowidcol . "='" . $rowid . "'";
    dol_syslog("delete", LOG_DEBUG);
    $result = $db->query($sql);
    if (!$result) {
        if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') {
            setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
        } else {
            dol_print_error($db);
        }
    }
}
// activate
if ($action == $acts[0]) {
    if ($tabrowid[$id]) {
        $rowidcol = $tabrowid[$id];
    } else {
        $rowidcol = "rowid";
    }
    if ($rowid) {
        $sql = "UPDATE " . $tabname[$id] . " SET active = 1 WHERE " . $rowidcol . "='" . $rowid . "'";
    } elseif ($_GET["code"]) {
示例#22
0
         $task->ref = GETPOST('ref', 'alpha');
         $task->label = $label;
         $task->description = $description;
         $task->planned_workload = $planned_workload;
         $task->fk_task_parent = $task_parent;
         $task->date_c = dol_now();
         $task->date_start = $date_start;
         $task->date_end = $date_end;
         $task->progress = $progress;
         // Fill array 'array_options' with data from add form
         $ret = $extrafields_task->setOptionalsFromPost($extralabels_task, $task);
         $taskid = $task->create($user);
         if ($taskid > 0) {
             $result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal');
         } else {
             setEventMessages($task->error, $task->errors, 'errors');
         }
     }
     if (!$error) {
         if (!empty($backtopage)) {
             header("Location: " . $backtopage);
             exit;
         } else {
             if (empty($projectid)) {
                 header("Location: " . DOL_URL_ROOT . '/projet/tasks/index.php' . (empty($mode) ? '' : '?mode=' . $mode));
                 exit;
             }
         }
         $id = $projectid;
     }
 } else {
示例#23
0
    }
}
if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) {
    require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
    $newobject = new Product($db);
    $result = $newobject->fetch($elemid);
    $elementtype = 'product';
    // TODO Add into categ
    $result = $object->add_type($newobject, $elementtype);
    if ($result >= 0) {
        setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
    } else {
        if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
        } else {
            setEventMessages($object->error, $object->errors, 'errors');
        }
    }
}
/*
 * View
 */
$form = new Form($db);
$formother = new FormOther($db);
llxHeader("", "", $langs->trans("Categories"));
if ($type == Categorie::TYPE_PRODUCT) {
    $title = $langs->trans("ProductsCategoryShort");
} elseif ($type == Categorie::TYPE_SUPPLIER) {
    $title = $langs->trans("SuppliersCategoryShort");
} elseif ($type == Categorie::TYPE_CUSTOMER) {
    $title = $langs->trans("CustomersCategoryShort");
示例#24
0
// Security check
if ($user->societe_id > 0) {
    accessforbidden();
}
/*
 * Actions
 */
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
    if (!GETPOST('cancel', 'alpha')) {
        $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
        $sql .= " SET fk_code_ventilation = " . $codeventil;
        $sql .= " WHERE rowid = " . $id;
        dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
        $resql = $db->query($sql);
        if (!$resql) {
            setEventMessages($db->lasterror(), null, 'errors');
        }
    } else {
        header("Location: ./lines.php");
        exit;
    }
}
/*
 * View
 */
llxHeader("", "", "FicheVentilation");
if ($cancel == $langs->trans("Cancel")) {
    $action = '';
}
/*
 * Create
示例#25
0
}
// Crop d'une image
if ($action == 'confirm_crop') {
    $fullpath = $dir . "/" . $original_file;
    $result = dol_imageResizeOrCrop($fullpath, 1, $_POST['w'], $_POST['h'], $_POST['x'], $_POST['y']);
    if ($result == $fullpath) {
        $object->add_thumb($fullpath);
        if ($backtourl) {
            header("Location: " . $backtourl);
            exit;
        } else {
            header("Location: " . DOL_URL_ROOT . "/product/document.php?id=" . $id . '&file=' . urldecode($_POST["file"]));
            exit;
        }
    } else {
        setEventMessages($result, null, 'errors');
        $_GET['file'] = $_POST["file"];
        $action = '';
    }
}
/*
 * View
 */
llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js', '/core/js/lib_photosresize.js'), array('/includes/jquery/plugins/jcrop/css/jquery.Jcrop.css'));
print load_fiche_titre($langs->trans("ImageEditor"));
$infoarray = dol_getImageSize($dir . "/" . urldecode($_GET["file"]));
$height = $infoarray['height'];
$width = $infoarray['width'];
print $langs->trans("CurrentInformationOnImage") . ': ';
print $langs->trans("Width") . ': <strong>' . $width . '</strong> x ' . $langs->trans("Height") . ': <strong>' . $height . '</strong><br>';
print '<br>' . "\n";
示例#26
0
$formfile = new FormFile($db);
$formproduct = new FormProduct($db);
$product_static = new Product($db);
if ($action == 'create2') {
    print load_fiche_titre($langs->trans("CreateASending")) . '<br>';
    print $langs->trans("ShipmentCreationIsDoneFromOrder");
    $action = '';
    $id = '';
    $ref = '';
}
// Mode creation.
if ($action == 'create') {
    $expe = new Expedition($db);
    print load_fiche_titre($langs->trans("CreateASending"));
    if (!$origin) {
        setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors');
    }
    if ($origin) {
        $classname = ucfirst($origin);
        $object = new $classname($db);
        if ($object->fetch($origin_id)) {
            //var_dump($object);
            $soc = new Societe($db);
            $soc->fetch($object->socid);
            $author = new User($db);
            $author->fetch($object->user_author_id);
            if (!empty($conf->stock->enabled)) {
                $entrepot = new Entrepot($db);
            }
            print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
示例#27
0
文件: list.php 项目: Albertopf/prueba
     exit;
 }
 $helpurl = '';
 if (isset($type)) {
     if ($type == 0) {
         $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
     } else {
         if ($type == 1) {
             $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
         }
     }
 }
 llxHeader('', $title, $helpurl, '');
 // Displays product removal confirmation
 if (GETPOST('delprod')) {
     setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
 }
 if ($search_categ > 0) {
     $param .= "&amp;search_categ=" . $search_categ;
 }
 if ($sref) {
     $param = "&amp;sref=" . $sref;
 }
 if ($search_ref_supplier) {
     $param = "&amp;search_ref_supplier=" . $search_ref_supplier;
 }
 if ($sbarcode) {
     $param .= $sbarcode ? "&amp;sbarcode=" . $sbarcode : "";
 }
 if ($snom) {
     $param .= "&amp;snom=" . $snom;
示例#28
0
        $error++;
    }
    if (!$error) {
        $db->begin();
        $sql = "UPDATE " . MAIN_DB_PREFIX . "bank";
        $sql .= " SET num_releve=" . ($num_rel ? "'" . $num_rel . "'" : "null");
        if (empty($num_rel)) {
            $sql .= ", rappro = 0";
        } else {
            $sql .= ", rappro = " . $rappro;
        }
        $sql .= " WHERE rowid = " . $rowid;
        dol_syslog("ligne.php", LOG_DEBUG);
        $result = $db->query($sql);
        if ($result) {
            setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
            $db->commit();
        } else {
            $db->rollback();
            dol_print_error($db);
        }
    }
}
/*
 * View
 */
$form = new Form($db);
llxHeader();
// The list of categories is initialized
$sql = "SELECT rowid, label";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_categ";
示例#29
0
                    }
                }
            }
        }
    }
} else {
    if ($action == 'confirm_deletefile' && $confirm == 'yes') {
        if ($object->fetch($id)) {
            $upload_dir = $conf->bank->dir_output;
            $file = $upload_dir . '/' . GETPOST('urlfile');
            // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
            $ret = dol_delete_file($file, 0, 0, 0, $object);
            if ($ret) {
                setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
            } else {
                setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
            }
            Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
            exit;
        }
    }
}
/*
 * View
 */
llxHeader();
$form = new Form($db);
if ($id > 0 || !empty($ref)) {
    if ($object->fetch($id, $ref)) {
        $upload_dir = $conf->bank->dir_output . '/' . $object->ref;
        // Onglets
示例#30
0
        if ($action == 'testsubscribe') {
            $result = $mailmanspip->add_to_mailman($object);
            if ($result < 0) {
                $error++;
                setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors');
            } else {
                setEventMessages($langs->trans("MailmanCreationSuccess"), null);
            }
        }
        if ($action == 'testunsubscribe') {
            $result = $mailmanspip->del_to_mailman($object);
            if ($result < 0) {
                $error++;
                setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors');
            } else {
                setEventMessages($langs->trans("MailmanDeletionSuccess"), null);
            }
        }
    }
}
/*
 * View
 */
$help_url = '';
llxHeader('', $langs->trans("MailmanSpipSetup"), $help_url);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans("MailmanSpipSetup"), $linkback, 'title_setup');
$head = mailmanspip_admin_prepare_head();
$var = true;
if (!empty($conf->global->ADHERENT_USE_MAILMAN)) {
    print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';