本文整理汇总了PHP中setEventMessages函数的典型用法代码示例。如果您正苦于以下问题:PHP setEventMessages函数的具体用法?PHP setEventMessages怎么用?PHP setEventMessages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setEventMessages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _exitOrNot
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: header
$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: setOptionalsFromPost
/**
* 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: array
$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: GETPOST
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: count
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: dol_fiche_head
}
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: setEventMessages
$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: str_replace
$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(',', '@'), $_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: header
}
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: dol_delete_file
// 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: dol_mktime
} 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ódulo_Stocks';
llxHeader("", $langs->trans("CardProduct" . $product->type), $help_url);
if ($result > 0) {
示例13: while
$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> <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> ' . ' ' . '<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&action=create&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: dol_print_error
$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: setEventMessages
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);