本文整理汇总了PHP中setEventMessages函数的典型用法代码示例。如果您正苦于以下问题:PHP setEventMessages函数的具体用法?PHP setEventMessages怎么用?PHP setEventMessages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setEventMessages函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_arronditotal,代码行数:13,代码来源:interface.php
示例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') {
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:supplier_order.php
示例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;
}
}
开发者ID:Samara94,项目名称:dolibarr,代码行数:58,代码来源:extrafields.class.php
示例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) {
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:list.php
示例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();
}
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:adherent.php
示例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)) {
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:facture.php
示例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;
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:printing.php
示例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++;
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:index.php
示例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]);
}
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:choix_date.php
示例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;
}
}
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:card.php
示例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
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:index.php
示例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) {
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:product.php
示例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();
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:index.php
示例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) {
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:codeinit.php
示例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);
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:card_subscriptions.php
示例16: dol_delete_file
// 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%";
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:31,代码来源:printsheet.php
示例17: sprintf
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);
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:graph.php
示例18: setEventMessages
}
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 {
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:fournisseurs.php
示例19: show_day_events2
/**
* 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;
}
//.........这里部分代码省略.........
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:101,代码来源:peruser.php
示例20: update
/**
* 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;
}
}
开发者ID:Samara94,项目名称:dolibarr,代码行数:67,代码来源:link.class.php
注:本文中的setEventMessages函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论