Merge branch 'develop' into NegativeBills

This commit is contained in:
David Beniamine 2019-03-26 23:59:10 +01:00 committed by GitHub
commit a9db67e6e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
155 changed files with 2272 additions and 1331 deletions

View File

@ -4,10 +4,13 @@ English Dolibarr ChangeLog
***** ChangeLog for 10.0.0 compared to 9.0.0 *****
For Users:
NEW: Module ticket is available as a stable module
NEW: Experimental module "Vendor receptions"
NEW: Module Ticket is available as a stable module.
NEW: Experimental module "Vendor receptions".
NEW: Experimental module "BOM".
FIX: Disallow line start date to be after end date
For Developers:
NEW: Module DebugBar is available as a stable module.
WARNING:
@ -21,6 +24,7 @@ Following changes may create regressions for some external modules, but were nec
* All methods set_draft() were renamed into setDraft().
* Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject.
* Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated.
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION
***** ChangeLog for 9.0.1 compared to 9.0.0 *****

View File

@ -247,7 +247,7 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle">' . $langs->trans("Addanaccount").'</span>';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle text-plus-circle">' . $langs->trans("Addanaccount").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';

View File

@ -113,11 +113,11 @@ if ($result)
if (! empty($user->rights->accounting->fiscalyear))
{
$addbutton = '<a class="butActionNew" href="fiscalyear_card.php?action=create"><span class="valignmiddle">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
$addbutton = '<a class="butActionNew" href="fiscalyear_card.php?action=create"><span class="valignmiddle text-plus-circle">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
else
{
$addbutton = '<a class="butActionRefused classfortooltip" href="#"><span class="valignmiddle" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
$addbutton = '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
$title = $langs->trans('AccountingPeriods');

View File

@ -333,7 +333,7 @@ if ($result)
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print '<td class="liste_titre"></td>';
// Current account
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
$listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
print '</td>';
@ -481,6 +481,14 @@ if ($result)
});
init_savebutton();
jQuery("#search_current_account").keyup(function() {
if (jQuery("#search_current_account").val() != \'\')
{
console.log("We set a value of account to search "+jQuery("#search_current_account").val()+", so we disable the other search criteria on account");
jQuery("#search_current_account_valid").val(-1);
}
});
});
</script>';

View File

@ -451,7 +451,7 @@ $button.= '</a>';
$groupby = ' <a class="nohover marginrightonly" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param.'">' . $langs->trans("GroupByAccountAccounting") . '</a>';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle">' . $langs->trans("NewAccountingMvt").'</span>';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewAccountingMvt").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';

View File

@ -257,7 +257,7 @@ if ($action == 'delbookkeepingyear') {
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
$viewflat = ' <a class="nohover marginrightonly" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param.'">' . $langs->trans("ViewFlatList") . '</a>';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle">' . $langs->trans("NewAccountingMvt").'</span>';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewAccountingMvt").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';

View File

@ -151,7 +151,7 @@ if ($object->id > 0)
$newcardbutton = '';
if (! empty($conf->agenda->enabled))
{
$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -365,7 +365,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->adherent->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewMember').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewMember').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -247,7 +247,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->adherent->cotisation->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle">'.$langs->trans('NewSubscription').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewSubscription').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
@ -284,7 +284,7 @@ $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfiel
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Line for filters fields

View File

@ -232,7 +232,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
$newcardbutton='';
if ($user->rights->adherent->configurer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/type.php?action=create"><span class="valignmiddle">'.$langs->trans('NewMemberType').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/type.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewMemberType').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
@ -47,8 +47,9 @@ if ($action == 'set')
{
$db->begin();
$result = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0);
if ($result < 0)
$result1 = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0);
$result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0);
if ($result1 < 0 || $result2 < 0)
{
$error++;
}
@ -61,7 +62,7 @@ if ($action == 'set')
else
{
$db->rollback();
setEventMessages($error, $errors, 'errors');
setEventMessages($error, null, 'errors');
}
}
@ -96,6 +97,12 @@ print '<td colspan="2"><input type="text" class="flat" name="DEBUGBAR_LOGS_LINES
print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput");
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>';
print '<td colspan="2">';
print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1);
print ' '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower");
print '</td></tr>';
print '</table>';
print "</form>\n";

View File

@ -207,7 +207,7 @@ else
print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'title_setup');
print $langs->trans("DefaultValuesDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("DefaultValuesDesc")."</span><br>\n";
print "<br>\n";
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;

View File

@ -178,10 +178,9 @@ if ($action == 'confirm_collect')
dol_include_once('/emailcollector/class/emailcollector.class.php');
$res = $object->doCollectOneCollector();
if ($res > 0)
{
setEventMessages($object->output, null, 'mesgs');
setEventMessages($object->lastresult, null, 'mesgs');
}
else
{
@ -391,7 +390,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
$connection = imap_open($connectstringsource, $object->user, $object->password);
$connection = imap_open($connectstringsource, $object->login, $object->password);
}
else
{
@ -443,8 +442,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Add filter
print '<tr class="oddeven">';
print '<td>';
$arrayoftypes=array('from'=>'MailFrom', 'to'=>'MailTo', 'cc'=>'Cc', 'bcc'=>'Bcc', 'subject'=>'Subject', 'body'=>'Body', 'seen'=>'AlreadyRead', 'unseen'=>'NotRead', 'withtrackingid'=>'WithDolTrackingID', 'withouttrackingid'=>'WithoutDolTrackingID');
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1);
$arrayoftypes=array(
'from'=>'MailFrom',
'to'=>'MailTo',
'cc'=>'Cc',
'bcc'=>'Bcc',
'subject'=>'Subject',
'body'=>'Body',
'X1'=>'---',
'seen'=>'AlreadyRead',
'unseen'=>'NotRead',
'X2'=>'---',
'withtrackingid'=>'WithDolTrackingID',
'withouttrackingid'=>'WithoutDolTrackingID'
);
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', '', 0, '', 2);
print '</td><td>';
print '<input type="text" name="rulevalue">';
print '</td>';
@ -462,7 +474,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td>';
print '<td>'.$rulefilter['rulevalue'].'</td>';
print '<td class="right">';
//print $rulefilterobj->getLibStatut(3);
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletefilter&filterid='.$rulefilter['id'].'">'.img_delete().'</a>';
print '</td>';
print '</tr>';

View File

@ -321,7 +321,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton='';
//if ($user->rights->emailcollector->creer)
//{
$newcardbutton='<a class="butActionNew" href="emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle">'.$langs->trans('New').'</span>';
$newcardbutton='<a class="butActionNew" href="emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
//}

View File

@ -51,48 +51,52 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
* View
*/
$form=new Form($db);
$page_name = "ExportSetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
//$head = export_admin_prepare_head();
$h=0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/export.php';
$head[$h][1] = $langs->trans("Setup");
$head[$h][2] = 'setup';
$h++;
dol_fiche_head(
$head,
'settings',
$langs->trans("ExportsArea"),
0,
"exports"
);
dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports");
// Setup page goes here
$form=new Form($db);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ExportModel").'</td>'."\n";
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" width="100"></td>'."\n";
// Example with a yes / no select
print '<tr class="oddeven">';
print '<td>'.$langs->trans("set_EXPORTS_SHARE_MODELS").'</td>';
print '<td>'.$langs->trans("EXPORTS_SHARE_MODELS").'</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" width="100">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_EXPORTS_SHARE_MODELS">';
echo ajax_constantonoff('EXPORTS_SHARE_MODELS');
print '</form>';
print '</td></tr>';
print '</table>';
dol_fiche_end();
// End of page
llxFooter();
$db->close();

View File

@ -217,7 +217,7 @@ $formadmin=new FormAdmin($db);
print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
print $langs->trans("DisplayDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
print "<br>\n";

View File

@ -37,11 +37,11 @@ $hookmanager->initHooks(array('homesetup'));
* View
*/
$form = new Form($db);
$wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp);
$form = new Form($db);
print load_fiche_titre($langs->trans("SetupArea"), '', 'title_setup.png');
@ -68,7 +68,7 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
}
}
print $langs->trans("SetupDescription1").' ';
print $langs->trans("SetupDescription1");
print $langs->trans("AreaForAdminOnly").' ';
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>";
@ -115,7 +115,7 @@ print $hookmanager->resPrint;
if (empty($reshook))
{
// Show into other
print $langs->trans("SetupDescription5")."<br>";
print '<span class="opacitymedium">'.$langs->trans("SetupDescription5")."</span><br>";
print "<br>";
// Show logo

View File

@ -256,7 +256,7 @@ if ($action == 'delete')
$newcardbutton='';
if ($user->admin)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle">'.$langs->trans('New').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -115,7 +115,7 @@ $arraydetailsforpdffoot = array(
print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
print $langs->trans("PDFDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("PDFDesc")."</span><br>\n";
print "<br>\n";
$noCountryCode = (empty($mysoc->country_code) ? true : false);

View File

@ -224,14 +224,12 @@ else
print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup');
//print '<span class="opacitymedium">';
print $langs->trans("TranslationDesc")."<br>\n";
//print '</span>';
print "<br>\n";
//print '<span class="opacitymedium">'.$langs->trans("TranslationDesc")."</span><br>\n";
//print "<br>\n";
$current_language_code=$langs->defaultlang;
$s=picto_from_langcode($current_language_code);
print $langs->trans("CurrentUserLanguage").': <strong>'.$s.' '.$current_language_code.'</strong><br>';
print $form->textwithpicto($langs->trans("CurrentUserLanguage").': <strong>'.$s.' '.$current_language_code.'</strong>', $langs->trans("TranslationDesc")).'<br>';
print '<br>';

View File

@ -316,13 +316,13 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton='';
//if ($user->rights->bom->creer)
//{
$newcardbutton='<a class="butActionNew" href="bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle">'.$langs->trans('New').'</span>';
$newcardbutton='<a class="butActionNew" href="bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
//}
//else
//{
// $newcardbutton='<a class="butActionNewRefused" href="#">'.$langs->trans('New');
// $newcardbutton='<a class="butActionNewRefused" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
// $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
// $newcardbutton.= '</a>';
//}

View File

@ -84,7 +84,7 @@ llxHeader('', $langs->trans("ListOfBookmarks"));
$newcardbutton='';
if ($user->rights->bookmark->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewBookmark').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewBookmark').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -65,7 +65,7 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle">'.$langs->trans("NewCategory").'</span>';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewCategory").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';

View File

@ -903,7 +903,7 @@ if ($action == 'create')
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
$urloption='?action=create';
$url = dol_buildpath('comm/action/card.php', 2).$urloption;
@ -1301,7 +1301,7 @@ if ($id > 0)
$numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0);
if ($numprojet==0)
{
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddProject").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
print '</td></tr>';
}

View File

@ -435,7 +435,7 @@ if ($resql)
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -367,7 +367,7 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -110,7 +110,7 @@ if (empty($reshook))
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// conditions de reglement
// terms of the settlement
if ($action == 'setconditions' && $user->rights->societe->creer)
{
$object->fetch($id);
@ -317,7 +317,7 @@ if ($object->id > 0)
print $object->tva_intra;
print '</td></tr>';
// Conditions de reglement par defaut
// default terms of the settlement
$langs->load('bills');
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';

View File

@ -156,7 +156,7 @@ if ($result)
$newcardbutton='';
if ($user->rights->mailing->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/mailing/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewMailing').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/mailing/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewMailing').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -1039,7 +1039,8 @@ if (empty($reshook))
$desc = $prod->description;
}
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc= $product_desc;
else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
// Add dimensions into product description
/*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM))
@ -1590,7 +1591,7 @@ if ($action == 'create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
}
print '</tr>' . "\n";
@ -1624,7 +1625,7 @@ if ($action == 'create')
// Terms of payment
print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
$form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id');
$form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
print '</td></tr>';
// Mode of payment
@ -1677,7 +1678,7 @@ if ($action == 'create')
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("AddProject") . '</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
print '</tr>';
}

View File

@ -473,6 +473,12 @@ class Propal extends CommonObject
// Check parameters
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
@ -666,7 +672,7 @@ class Propal extends CommonObject
*/
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
{
global $mysoc;
global $mysoc, $langs;
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
@ -684,6 +690,12 @@ class Propal extends CommonObject
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
if (empty($type)) $type=0;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
if ($this->statut == self::STATUS_DRAFT)
{

View File

@ -438,7 +438,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->propal->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewPropal').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewPropal').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

11
htdocs/commande/card.php Normal file → Executable file
View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -868,7 +868,8 @@ if (empty($reshook))
$desc = $prod->description;
}
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc= $product_desc;
else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
@ -1636,7 +1637,7 @@ if ($action == 'create' && $user->rights->commande->creer)
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
}
print '</tr>' . "\n";
@ -1674,7 +1675,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print $form->selectDate($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1);
print "</td></tr>";
// Conditions de reglement
// terms of the settlement
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1);
print '</td></tr>';
@ -1727,7 +1728,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("AddProject") . '</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
print '</tr>';
}

View File

@ -1367,6 +1367,12 @@ class Commande extends CommonOrder
// Check parameters
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
@ -2932,7 +2938,6 @@ class Commande extends CommonOrder
if ($this->statut == Propal::STATUS_DRAFT)
{
$this->db->begin();
// Clean parameters
if (empty($qty)) $qty=0;
@ -2942,6 +2947,12 @@ class Commande extends CommonOrder
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($remise_percent)) $remise_percent=0;
if (empty($special_code) || $special_code == 3) $special_code=0;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
@ -2951,6 +2962,8 @@ class Commande extends CommonOrder
$txtva=price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$this->db->begin();
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
@ -441,7 +441,7 @@ if ($resql)
$newcardbutton='';
if ($contextpage == 'orderlist' && $user->rights->commande->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/commande/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewOrder').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/commande/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewOrder').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -757,11 +757,11 @@ if ($resql)
if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
{
if ($user->rights->banque->modifier) {
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)).'"><span class="valignmiddle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
} else {
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord");
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
@ -769,11 +769,11 @@ if ($resql)
else // If direct entries is not done using miscellaneous payments
{
if ($user->rights->banque->modifier) {
$newcardbutton = '<a class="butActionNew" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord");
$newcardbutton = '<a class="butActionNew" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
} else {
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord");
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
@ -781,7 +781,7 @@ if ($resql)
}
else
{
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord");
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("FeatureDisabled").'" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -227,7 +227,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->banque->configurer)
{
$newcardbutton.='<a class="butActionNew" href="card.php?action=create"><span class="valignmiddle">'.$langs->trans("NewFinancialAccount").'</span>';
$newcardbutton.='<a class="butActionNew" href="card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewFinancialAccount").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -157,7 +157,7 @@ if ($result)
$newcardbutton='';
if ($user->rights->banque->modifier)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create"><span class="valignmiddle">'.$langs->trans('MenuNewVariousPayment').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuNewVariousPayment').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -337,7 +337,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton='';
//if ($user->rights->monmodule->creer)
//{
$newcardbutton='<a class="butActionNew" href="cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle">'.$langs->trans('New').'</span>';
$newcardbutton='<a class="butActionNew" href="cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
//}

7
htdocs/compta/facture/card.php Normal file → Executable file
View File

@ -1844,7 +1844,8 @@ if (empty($reshook))
$desc = $prod->description;
}
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc= $product_desc;
else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
@ -2697,7 +2698,7 @@ if ($action == 'create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
}
print '</tr>' . "\n";
@ -3093,7 +3094,7 @@ if ($action == 'create')
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec?'&fac_rec='.$fac_rec:'')).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("AddProject") . '</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td></tr>';
}

View File

@ -2720,6 +2720,12 @@ class Facture extends CommonInvoice
// Check parameters
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
@ -2923,6 +2929,12 @@ class Facture extends CommonInvoice
return -3;
}
}
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();

View File

@ -594,7 +594,7 @@ if ($resql)
$newcardbutton='';
if($user->rights->facture->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewBill').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewBill').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -45,7 +45,7 @@ $localtax_static = new Localtax($db);
$newcardbutton='';
if ($user->rights->tax->charges->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt.'"><span class="valignmiddle">'.$langs->trans('NewLocalTaxPayment', ($ltt+1)).'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt.'"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewLocalTaxPayment', ($ltt+1)).'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -138,7 +138,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->banque->cheque)
{
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new"><span class="valignmiddle">'.$langs->trans('NewCheckDeposit').'</span>';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewCheckDeposit').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -108,7 +108,7 @@ if ($result)
$newcardbutton='';
if ($user->rights->prelevement->bons->creer)
{
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/prelevement/create.php"><span class="valignmiddle">'.$langs->trans('NewStandingOrder').'</span>';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/prelevement/create.php"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewStandingOrder').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -150,7 +150,7 @@ if ($result)
$newcardbutton='';
if (! empty($user->rights->salaries->write))
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/salaries/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewSalaryPayment').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/salaries/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewSalaryPayment').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -152,7 +152,7 @@ if ($resql)
$newcardbutton='';
if($user->rights->tax->charges->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?action=create">'.$langs->trans('MenuNewSocialContribution');
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuNewSocialContribution').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

File diff suppressed because it is too large Load Diff

View File

@ -150,7 +150,7 @@ if ($result)
$newcardbutton='';
if ($user->rights->tax->charges->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/tva/card.php?action=create">'.$langs->trans('NewVATPayment');
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/tva/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewVATPayment').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -261,7 +261,7 @@ else
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -453,7 +453,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->societe->contact->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contact/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewContactAddress').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contact/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewContactAddress').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -540,7 +540,7 @@ if (empty($reshook))
}
$desc=$prod->description;
$desc=dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
$desc=dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
$fk_unit = $prod->fk_unit;
}
else
@ -1212,7 +1212,7 @@ if ($action == 'create')
{
print '<td>';
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300');
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
}
print '</tr>'."\n";
@ -1254,7 +1254,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$formproject->select_projects(($soc->id>0?$soc->id:-1), $projectid, "projectid", 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("AddProject") . '</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print "</td></tr>";
}

View File

@ -1374,7 +1374,6 @@ class Contrat extends CommonObject
if ($this->statut >= 0)
{
$this->db->begin();
// Clean parameters
$pu_ht=price2num($pu_ht);
@ -1394,7 +1393,7 @@ class Contrat extends CommonObject
if (empty($txtva) || ! is_numeric($txtva)) $txtva=0;
if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0;
if ($price_base_type=='HT')
{
$pu=$pu_ht;
@ -1406,6 +1405,14 @@ class Contrat extends CommonObject
// Check parameters
if (empty($remise_percent)) $remise_percent=0;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
@ -1596,6 +1603,12 @@ class Contrat extends CommonObject
{
$remise_percent=0;
}
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $date_debut_reel, $date_fin_reel, $tvatx, $localtax1tx, $localtax2tx, $price_base_type, $info_bits");

View File

@ -204,7 +204,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Ligne info remises tiers

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -25,7 +25,7 @@
/**
* \file htdocs/contrat/list.php
* \ingroup contrat
* \brief Page liste des contrats
* \brief Page to list contracts
*/
require '../main.inc.php';
@ -375,7 +375,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->contrat->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewContractSubscription').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewContractSubscription').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
@ -549,11 +549,11 @@ if (! empty($arrayfields['lower_planned_end_date']['checked']))
{
print '<td class="liste_titre nowraponall center">';
$arrayofoperators=array('0'=>'','='=>'=','<='=>'<=','>='=>'>=');
print $form->selectarray('search_op2df', $arrayofoperators, $search_op2df, 0);
print $form->selectarray('search_op2df', $arrayofoperators, $search_op2df, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth50imp');
print '</br>';
print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0, 'valignmiddle');
print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0);
print ' ';
$formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, '', 'valignmiddle');
$formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, '');
print '</td>';
}
// Status
@ -568,18 +568,18 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", "$param", '', $sortfield, $sortorder);
if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", "$param", '', $sortfield, $sortorder);
if (! empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", "$param", '', $sortfield, $sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", "$param", '', $sortfield, $sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", "$param", '', $sortfield, $sortorder);
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
if (! empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", "$param", '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", $param, '', $sortfield, $sortorder, 'center ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields

View File

@ -616,6 +616,12 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
for ($i=0;$i<$num;$i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
// If we build one invoice for several order, we must put the invoice of order on the line
if (! empty($createbills_onebythird))
{
$desc=dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs));
}
if ($lines[$i]->subprice < 0)
{
// Negative line, we create a discount line

View File

@ -598,6 +598,7 @@ abstract class CommonInvoice extends CommonObject
// 2 : application de la règle, le N du mois courant ou suivant
elseif ($cdr_type == 2 && !empty($cdr_decalage))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$datelim = $this->date + ($cdr_nbjour * 3600 * 24);
$date_piece = dol_mktime(0, 0, 0, date('m', $datelim), date('d', $datelim), date('Y', $datelim)); // Sans les heures minutes et secondes

View File

@ -1653,7 +1653,7 @@ class ExtraFields
}
elseif ($type == 'phone')
{
$value=dol_print_phone($value, '', 0, 0, '', '&nbsp;', 1);
$value=dol_print_phone($value, '', 0, 0, '', '&nbsp;', 'phone');
}
elseif ($type == 'price')
{

View File

@ -5841,10 +5841,10 @@ class Form
* @param string $morecss Add more class to css styles
* @param int $addjscombo Add js combo
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set
* @param int $disablebademail Check if an email is found into value and if not disable and colorize entry
* @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry
* @param int $nohtmlescape No html escaping.
* @return string HTML select string.
* @see multiselectarray, selectArrayAjax, selectArrayFilter
* @see multiselectarray(), selectArrayAjax(), selectArrayFilter()
*/
public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '', $addjscombo = 0, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)
{
@ -5902,9 +5902,9 @@ class Form
$disabled=''; $style='';
if (! empty($disablebademail))
{
if (! preg_match('/&lt;.+@.+&gt;/', $value))
if (($disablebademail == 1 && ! preg_match('/&lt;.+@.+&gt;/', $value))
|| ($disablebademail == 2 && preg_match('/---/', $value)))
{
//$value=preg_replace('/'.preg_quote($a,'/').'/', $b, $value);
$disabled=' disabled';
$style=' class="warning"';
}
@ -6610,7 +6610,11 @@ class Form
// Can complete the possiblelink array
$hookmanager->initHooks(array('commonobject'));
$parameters=array('listofidcompanytoscan' => $listofidcompanytoscan);
$reshook=$hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (! empty($listofidcompanytoscan)) // If empty, we don't have criteria to scan the object we can link to
{
$reshook=$hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
}
if (empty($reshook))
{

View File

@ -205,7 +205,7 @@ class FormActions
$newcardbutton='';
if (! empty($conf->agenda->enabled))
{
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:($socid>0?'&socid='.$socid:'')).($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'"><span class="valignmiddle">'.$langs->trans("AddEvent").'</span>';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:($socid>0?'&socid='.$socid:'')).($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddEvent").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -1044,7 +1044,7 @@ class FormFile
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
* @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
* @see list_of_autoecmfiles
* @see list_of_autoecmfiles()
*/
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0)
{

View File

@ -63,8 +63,8 @@ class FormOther
* @param string $selected Id modele pre-selectionne
* @param string $htmlname Nom de la zone select
* @param string $type Type des modeles recherches
* @param int $useempty Affiche valeur vide dans liste
* @param int $fk_user Utilisateur créant le modèle
* @param int $useempty Show an empty value in list
* @param int $fk_user User that has created the template (this is set to null to get all export model when EXPORTS_SHARE_MODELS is on)
* @return void
*/
public function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)
@ -73,7 +73,7 @@ class FormOther
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
$sql.= " WHERE type = '".$type."'";
if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user;
if (!empty($fk_user)) $sql.=" AND fk_user IN (0, ".$fk_user.")"; // An export model
$sql.= " ORDER BY rowid";
$result = $this->db->query($sql);
if ($result)
@ -848,7 +848,7 @@ class FormOther
* @param string $morecss More Css
* @return string
*/
public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = '')
public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'maxwidth50imp valignmiddle')
{
// phpcs:enable
global $langs;
@ -895,7 +895,7 @@ class FormOther
* @param string $morecss More CSS
* @return string
*/
public function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
public function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp')
{
// phpcs:enable
print $this->selectyear($selected, $htmlname, $useempty, $min_year, $max_year, $offset, $invert, $option, $morecss);
@ -915,7 +915,7 @@ class FormOther
* @param string $morecss More css
* @return string
*/
public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp')
{
$out='';

View File

@ -572,12 +572,13 @@ class Utils
*/
public function generateDoc($module)
{
global $conf, $langs, $user;
global $conf, $langs, $user, $mysoc;
global $dirins;
$error = 0;
$modulelowercase=strtolower($module);
$now=dol_now();
// Dir for module
$dir = $dirins.'/'.$modulelowercase;
@ -688,16 +689,16 @@ class Utils
//var_dump($phpfileval['fullname']);
$arrayreplacement=array(
'mymodule'=>strtolower($modulename),
'MyModule'=>$modulename,
'MYMODULE'=>strtoupper($modulename),
'My module'=>$modulename,
'my module'=>$modulename,
'Mon module'=>$modulename,
'mon module'=>$modulename,
'htdocs/modulebuilder/template'=>strtolower($modulename),
'mymodule'=>strtolower($module),
'MyModule'=>$module,
'MYMODULE'=>strtoupper($module),
'My module'=>$module,
'my module'=>$module,
'Mon module'=>$module,
'mon module'=>$module,
'htdocs/modulebuilder/template'=>strtolower($module),
'__MYCOMPANY_NAME__'=>$mysoc->name,
'__KEYWORDS__'=>$modulename,
'__KEYWORDS__'=>$module,
'__USER_FULLNAME__'=>$user->getFullName($langs),
'__USER_EMAIL__'=>$user->email,
'__YYYY-MM-DD__'=>dol_print_date($now, 'dayrfc'),

View File

@ -161,7 +161,7 @@ class DoliDBMssql extends DoliDB
* @param string $name name of database (not used for mysql, used for pgsql)
* @param int $port Port of database server
* @return false|resource|true Database access handler
* @see close
* @see close()
*/
public function connect($host, $login, $passwd, $name, $port = 0)
{
@ -216,7 +216,7 @@ class DoliDBMssql extends DoliDB
* Close database connexion
*
* @return bool True if disconnect successfull, false otherwise
* @see connect
* @see connect()
*/
public function close()
{
@ -511,7 +511,7 @@ class DoliDBMssql extends DoliDB
*
* @param resource $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
* @see affected_rows()
*/
public function num_rows($resultset)
{
@ -527,7 +527,7 @@ class DoliDBMssql extends DoliDB
*
* @param resource $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @see num_rows
* @see num_rows()
*/
public function affected_rows($resultset)
{

View File

@ -191,7 +191,7 @@ class DoliDBMysqli extends DoliDB
* @param string $name name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return mysqli Database access object
* @see close
* @see close()
*/
public function connect($host, $login, $passwd, $name, $port = 0)
{
@ -228,7 +228,7 @@ class DoliDBMysqli extends DoliDB
* Close database connexion
*
* @return bool True if disconnect successfull, false otherwise
* @see connect
* @see connect()
*/
public function close()
{
@ -280,6 +280,7 @@ class DoliDBMysqli extends DoliDB
if ($conf->global->SYSLOG_LEVEL < LOG_DEBUG) dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); // Log of request was not yet done previously
dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterrno." ".$this->lasterror, LOG_ERR);
//var_dump(debug_print_backtrace());
}
$this->lastquery=$query;
$this->_results = $ret;
@ -324,7 +325,7 @@ class DoliDBMysqli extends DoliDB
* Return datas as an array
*
* @param mysqli_result $resultset Resultset of request
* @return array|null|0 Array or null if KO or end of cursor or 0 if resultset is bool
* @return array|null|int Array or null if KO or end of cursor or 0 if resultset is bool
*/
public function fetch_row($resultset)
{
@ -348,7 +349,7 @@ class DoliDBMysqli extends DoliDB
*
* @param mysqli_result $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
* @see affected_rows()
*/
public function num_rows($resultset)
{
@ -364,7 +365,7 @@ class DoliDBMysqli extends DoliDB
*
* @param mysqli_result $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @see num_rows
* @see num_rows()
*/
public function affected_rows($resultset)
{
@ -952,7 +953,7 @@ class DoliDBMysqli extends DoliDB
* Note: if we are connected to databasename, it is same result than using SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "databasename";)
*
* @return string Charset
* @see getDefaultCollationDatabase
* @see getDefaultCollationDatabase()
*/
public function getDefaultCharacterSetDatabase()
{
@ -998,7 +999,7 @@ class DoliDBMysqli extends DoliDB
* Return collation used in current database
*
* @return string Collation value
* @see getDefaultCharacterSetDatabase
* @see getDefaultCharacterSetDatabase()
*/
public function getDefaultCollationDatabase()
{

View File

@ -396,7 +396,7 @@ class DoliDBPgsql extends DoliDB
* @param string $name Name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return false|resource Database access handler
* @see close
* @see close()
*/
public function connect($host, $login, $passwd, $name, $port = 0)
{
@ -471,7 +471,7 @@ class DoliDBPgsql extends DoliDB
* Close database connexion
*
* @return boolean True if disconnect successfull, false otherwise
* @see connect
* @see connect()
*/
public function close()
{
@ -605,7 +605,7 @@ class DoliDBPgsql extends DoliDB
*
* @param resourse $resultset Resulset of requests
* @return int Nb of lines, -1 on error
* @see affected_rows
* @see affected_rows()
*/
public function num_rows($resultset)
{

View File

@ -321,7 +321,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $name name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return SQLite3 Database access handler
* @see close
* @see close()
*/
public function connect($host, $login, $passwd, $name, $port = 0)
{
@ -377,7 +377,7 @@ class DoliDBSqlite3 extends DoliDB
* Close database connexion
*
* @return bool True if disconnect successfull, false otherwise
* @see connect
* @see connect()
*/
public function close()
{
@ -557,7 +557,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @param SQLite3Result $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
* @see affected_rows()
*/
public function num_rows($resultset)
{
@ -578,7 +578,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @param SQLite3Result $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
* @see affected_rows()
*/
public function affected_rows($resultset)
{

View File

@ -730,7 +730,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$newcardbutton='';
if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink))
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'"><span class="valignmiddle">'.$langs->trans("AddProject").'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
@ -934,7 +934,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
if ($user->rights->societe->contact->creer)
{
$addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'"><span class="valignmiddle">'.$addcontact.'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'"><span class="valignmiddle text-plus-circle">'.$addcontact.'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -1823,24 +1823,27 @@ function deleteFilesIntoDatabaseIndex($dir, $file, $mode = 'uploaded')
* @param string $fileinput Input file name
* @param string $ext Format of target file (It is also extension added to file if fileoutput is not provided).
* @param string $fileoutput Output filename
* @param string $page Page number if we convert a PDF into png
* @return int <0 if KO, 0=Nothing done, >0 if OK
*/
function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '')
function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = '')
{
global $langs;
if (class_exists('Imagick'))
{
$image=new Imagick();
$image=new Imagick();
try {
$ret = $image->readImage($fileinput);
$filetoconvert=$fileinput.(($page != '')?'['.$page.']':'');
//var_dump($filetoconvert);
$ret = $image->readImage($filetoconvert);
} catch(Exception $e) {
dol_syslog("Failed to read image using Imagick. Try to install package 'apt-get install ghostscript'.", LOG_WARNING);
$ext = pathinfo($fileinput, PATHINFO_EXTENSION);
dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install php-imagick ghostscript' and check there is no policy to disable ".$ext." convertion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING);
return 0;
}
if ($ret)
{
$ret = $image->setImageFormat($ext);
$ret = $image->setImageFormat($ext);
if ($ret)
{
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;

View File

@ -982,7 +982,7 @@ function dol_strtoupper($utf8_string)
*/
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = '', $restricttologhandler = '')
{
global $conf, $user;
global $conf, $user, $debugbar;
// If syslog module enabled
if (empty($conf->syslog->enabled)) return;
@ -998,8 +998,8 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
if (! empty($message))
{
// Test log level
$logLevels = array(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG);
if (!in_array($level, $logLevels, true))
$logLevels = array(LOG_EMERG=>'EMERG', LOG_ALERT=>'ALERT', LOG_CRIT=>'CRITICAL', LOG_ERR=>'ERR', LOG_WARNING=>'WARN', LOG_NOTICE=>'NOTICE', LOG_INFO=>'INFO', LOG_DEBUG=>'DEBUG');
if (! array_key_exists($level, $logLevels))
{
throw new Exception('Incorrect log level');
}
@ -1008,9 +1008,10 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
$message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log
// If adding log inside HTML page is required
if (! empty($_REQUEST['logtohtml']) && (! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || ! empty($conf->global->MAIN_LOGTOHTML))) // MAIN_LOGTOHTML kept for backward compatibility
if ((! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML))
|| (! empty($user->rights->debugbar->read) && is_object($debugbar)))
{
$conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$message;
$conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$logLevels[$level]." ".$message;
}
//TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output
@ -1381,53 +1382,46 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$filepath = $dir_output . $subdir . "/";
$file = $filepath . $objectref . ".pdf";
$filepdf = $filepath . $objectref . ".pdf";
$relativepath = $subdir.'/'.$objectref.'.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
$fileimage = $file.'_preview.png'; // If PDF has 1 page
$fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
$fileimage = $filepdf.'_preview.png';
$relativepathimage = $relativepath.'_preview.png';
// Si fichier PDF existe
if (file_exists($file))
$pdfexists = file_exists($filepdf);
// If PDF file exists
if ($pdfexists)
{
$encfile = urlencode($file);
// Conversion du PDF en image png si fichier png non existant
if ( (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($file)))
&& (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file)))
)
if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf)))
{
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$ret = dol_convert_file($file, 'png', $fileimage);
$ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png
if ($ret < 0) $error++;
}
}
}
if ($pdfexists && ! $error)
{
$heightforphotref=70;
if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60;
// Si fichier png PDF d'1 page trouve
// If the preview file is found
if (file_exists($fileimage))
{
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
$phototoshow.= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
$phototoshow.= '</div></div>';
}
// Si fichier png PDF de plus d'1 page trouve
elseif (file_exists($fileimagebis))
{
$preview = preg_replace('/\.png/', '', $relativepathimage) . "-0.png";
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
$phototoshow.= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($preview).'"><p>';
$phototoshow.= '</div></div>';
}
}
}
elseif (! $phototoshow)
{
$phototoshow = $form->showphoto($modulepart, $object, 0, 0, 0, 'photoref', 'small', 1, 0, $maxvisiblephotos);
$phototoshow.= $form->showphoto($modulepart, $object, 0, 0, 0, 'photoref', 'small', 1, 0, $maxvisiblephotos);
}
if ($phototoshow)
@ -1440,7 +1434,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if (! $phototoshow) // Show No photo link (picto of pbject)
{
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
if ($object->element == 'action')
{
$width=80;
@ -5760,7 +5754,7 @@ function dol_textishtml($msg, $option = 0)
* @param string $text1 Text 1
* @param string $text2 Text 2
* @param bool $forxml false=Use <br>instead of \n if html content detected, true=Use <br /> instead of \n if html content detected
* @param bool $invert invert order of description lines if CONF CHANGE_ORDER_CONCAT_DESCRIPTION is active
* @param bool $invert invert order of description lines (we often use config MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION in this parameter)
* @return string Text 1 + new line + Text2
* @see dol_textishtml()
*/
@ -7164,7 +7158,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
*/
function printCommonFooter($zone = 'private')
{
global $conf, $hookmanager, $user;
global $conf, $hookmanager, $user, $debugbar;
global $action;
global $micro_start_time;
@ -7328,11 +7322,17 @@ function printCommonFooter($zone = 'private')
// Add Xdebug coverage of code
if (defined('XDEBUGCOVERAGE'))
{
print_r(xdebug_get_code_coverage());
print_r(xdebug_get_code_coverage());
}
// If there is some logs in buffer to show
if (count($conf->logbuffer))
// Add DebugBar data
if (! empty($user->rights->debugbar->read) && is_object($debugbar))
{
$debugbar['time']->stopMeasure('pageaftermaster');
print '<!-- Output debugbar data -->'."\n";
print $debugbar->getRenderer()->render();
}
elseif (count($conf->logbuffer)) // If there is some logs in buffer to show
{
print "\n";
print "<!-- Start of log output\n";
@ -8027,7 +8027,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
}
if ($displayMode === 2) {
$return = $htmlImg .' '. $htmlLabel;
$return = $htmlImg .' '. $htmlLabelShort;
}
elseif ($displayMode === 3) {
$return = $htmlImg;

View File

@ -207,7 +207,7 @@ function dol_print_object_info($object, $usetable = 0)
$deltadateforuser=round($deltadateforclient-$deltadateforserver);
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
if ($usetable) print '<table class="border centpercent">';
if ($usetable) print '<table class="border tableforfield centpercent">';
// Import key
if (! empty($object->import_key))
@ -2207,9 +2207,9 @@ function colorStringToArray($stringcolor, $colorifnotfound = array(88,88,88))
*/
function colorValidateHex($color, $allow_white = true)
{
if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false;
if(preg_match('/^#[a-f0-9]{6}$/i', $color)) //hex color is valid
{
return true;
@ -2227,23 +2227,23 @@ function colorAdjustBrightness($hex, $steps)
{
// Steps should be between -255 and 255. Negative = darker, positive = lighter
$steps = max(-255, min(255, $steps));
// Normalize into a six character long hex string
$hex = str_replace('#', '', $hex);
if (strlen($hex) == 3) {
$hex = str_repeat(substr($hex, 0, 1), 2).str_repeat(substr($hex, 1, 1), 2).str_repeat(substr($hex, 2, 1), 2);
}
// Split into three parts: R, G and B
$color_parts = str_split($hex, 2);
$return = '#';
foreach ($color_parts as $color) {
$color = hexdec($color); // Convert to decimal
$color = max(0, min(255, $color + $steps)); // Adjust color
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
}
return $return;
}
@ -2292,7 +2292,7 @@ function colorHexToRgb($hex, $alpha = false, $returnArray = false)
else{
$string = 'rgb('.implode(',', $rgb).')';
}
if($returnArray){
return $rgb;
}

View File

@ -33,7 +33,7 @@ $quality = 80;
* Return if a filename is file name of a supported image format
*
* @param string $file Filename
* @return int -1=Not image filename, 0=Image filename but format not supported by PHP, 1=Image filename with format supported
* @return int -1=Not image filename, 0=Image filename but format not supported by PHP, 1=Image filename with format supported by this PHP
*/
function image_format_supported($file)
{

View File

@ -104,7 +104,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&amp;leftmenu=product&amp;type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&amp;leftmenu=product&amp;action=create&amp;type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?mainmenu=products&amp;leftmenu=product&amp;type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&amp;type=0', 'Stocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&amp;type=0', 'MenuStocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&amp;type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2806__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php?mainmenu=products', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __ENTITY__);

View File

@ -1500,7 +1500,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/product/list.php?leftmenu=product&amp;type=0", $langs->trans("List"), 1, $user->rights->produit->lire);
if (! empty($conf->stock->enabled))
{
$newmenu->add("/product/reassort.php?type=0", $langs->trans("Stocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
$newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
}
if (! empty($conf->productbatch->enabled))
{

View File

@ -54,18 +54,7 @@ class modDebugBar extends DolibarrModules
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto='technic';
$this->module_parts = array(
// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
'hooks' => array(
'data' => array(
'main',
'login',
),
'entity' => '0',
),
// Set this to 1 if feature of module are opened to external users
'moduleforexternal' => 0,
);
$this->module_parts = array('moduleforexternal' => 0);
// Data directories to create when module is enabled
$this->dirs = array();
@ -80,9 +69,7 @@ class modDebugBar extends DolibarrModules
// Constants
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
$this->const = array(
0 => array('DEBUGBAR_LOGS_LINES_NUMBER', 'chaine', '100', 'Number of log lines to show in debug bar', 1)
);
$this->const = array();
// Boxes
$this->boxes = array();

View File

@ -346,13 +346,13 @@ print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
$newcardbutton='';
if ($user->rights->cron->create)
{
$newcardbutton.='<a class="butActionNew" style="margin-right: 0px;margin-left: 0px;" href="'.DOL_URL_ROOT.'/cron/card.php?action=create"><span class="valignmiddle">'.$langs->trans("CronCreateJob").'</span>';
$newcardbutton.='<a class="butActionNew" style="margin-right: 0px;margin-left: 0px;" href="'.DOL_URL_ROOT.'/cron/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("CronCreateJob").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
else
{
$newcardbutton.='<a class="butActionNewRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'"><span class="valignmiddle">'.$langs->trans("CronCreateJob").'</span>';
$newcardbutton.='<a class="butActionNewRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("CronCreateJob").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -17,7 +17,7 @@ class DolLogsCollector extends MessagesCollector
/**
* @var int number of lines to show
*/
protected $lines;
protected $maxnboflines;
/**
* Constructor
@ -31,8 +31,10 @@ class DolLogsCollector extends MessagesCollector
parent::__construct($name);
$this->nboflines=0;
$this->maxnboflines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // High number slows seriously output
$this->path = $path ?: $this->getLogsFile();
$this->lines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // This slow seriously output
}
/**
@ -68,7 +70,31 @@ class DolLogsCollector extends MessagesCollector
*/
public function collect()
{
$this->getStorageLogs($this->path);
global $conf;
$uselogfile=$conf->global->DEBUGBAR_USE_LOGFILE;
if ($uselogfile)
{
$this->getStorageLogs($this->path);
}
else
{
$log_levels = $this->getLevels();
foreach ($conf->logbuffer as $line) {
if ($this->nboflines >= $this->maxnboflines)
{
break;
}
foreach ($log_levels as $level_key => $level) {
if (strpos(strtolower($line), strtolower($level_key)) == 20) {
$this->nboflines++;
$this->addMessage($line, $level, false);
}
}
}
}
return parent::collect();
}
@ -76,14 +102,13 @@ class DolLogsCollector extends MessagesCollector
/**
* Get the path to the logs file
*
* @return string Path of log file
* @return string
*/
public function getLogsFile()
{
// default dolibarr log file
$path = DOL_DATA_ROOT . '/dolibarr.log';
return $path;
// default dolibarr log file
$path = DOL_DATA_ROOT . '/dolibarr.log';
return $path;
}
/**
@ -94,16 +119,16 @@ class DolLogsCollector extends MessagesCollector
*/
public function getStorageLogs($path)
{
if (! file_exists($path)) {
return;
}
if (! file_exists($path)) {
return;
}
// Load the latest lines
$file = implode("", $this->tailFile($path, $this->lines));
// Load the latest lines
$file = implode("", $this->tailFile($path, $this->maxnboflines));
foreach ($this->getLogs($file) as $log) {
$this->addMessage($log['line'], $log['level'], false);
}
foreach ($this->getLogs($file) as $log) {
$this->addMessage($log['line'], $log['level'], false);
}
}
/**
@ -115,32 +140,32 @@ class DolLogsCollector extends MessagesCollector
*/
protected function tailFile($file, $lines)
{
$handle = fopen($file, "r");
$linecounter = $lines;
$pos = -2;
$beginning = false;
$text = [];
while ($linecounter > 0) {
$t = " ";
while ($t != "\n") {
if (fseek($handle, $pos, SEEK_END) == -1) {
$beginning = true;
break;
}
$t = fgetc($handle);
$pos--;
}
$linecounter--;
if ($beginning) {
rewind($handle);
}
$text[$lines - $linecounter - 1] = fgets($handle);
if ($beginning) {
break;
}
}
fclose($handle);
return array_reverse($text);
$handle = fopen($file, "r");
$linecounter = $lines;
$pos = -2;
$beginning = false;
$text = [];
while ($linecounter > 0) {
$t = " ";
while ($t != "\n") {
if (fseek($handle, $pos, SEEK_END) == -1) {
$beginning = true;
break;
}
$t = fgetc($handle);
$pos--;
}
$linecounter--;
if ($beginning) {
rewind($handle);
}
$text[$lines - $linecounter - 1] = fgets($handle);
if ($beginning) {
break;
}
}
fclose($handle);
return array_reverse($text);
}
/**
@ -151,21 +176,21 @@ class DolLogsCollector extends MessagesCollector
*/
public function getLogs($file)
{
$pattern = "/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*/";
$log_levels = $this->getLevels();
preg_match_all($pattern, $file, $matches);
$log = [];
foreach ($matches as $lines) {
foreach ($lines as $line) {
foreach ($log_levels as $level_key => $level) {
if (strpos(strtolower($line), strtolower($level_key)) == 20) {
$log[] = ['level' => $level, 'line' => $line];
}
}
}
}
$log = array_reverse($log);
return $log;
$pattern = "/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*/";
$log_levels = $this->getLevels();
preg_match_all($pattern, $file, $matches);
$log = [];
foreach ($matches as $lines) {
foreach ($lines as $line) {
foreach ($log_levels as $level_key => $level) {
if (strpos(strtolower($line), strtolower($level_key)) == 20) {
$log[] = ['level' => $level, 'line' => $line];
}
}
}
}
$log = array_reverse($log);
return $log;
}
/**
@ -178,6 +203,7 @@ class DolLogsCollector extends MessagesCollector
$class = new ReflectionClass(new LogLevel());
$levels = $class->getConstants();
$levels['ERR'] = 'error';
$levels['WARN'] = 'warning';
return $levels;
}

View File

@ -31,12 +31,12 @@ class DolibarrDebugBar extends DebugBar
global $conf;
//$this->addCollector(new PhpInfoCollector());
$this->addCollector(new DolMessagesCollector());
//$this->addCollector(new DolMessagesCollector());
$this->addCollector(new DolRequestDataCollector());
$this->addCollector(new DolConfigCollector());
$this->addCollector(new DolTimeDataCollector());
$this->addCollector(new DolMemoryCollector());
$this->addCollector(new DolExceptionsCollector());
//$this->addCollector(new DolExceptionsCollector());
$this->addCollector(new DolQueryCollector());
$this->addCollector(new DolibarrCollector());
if ($conf->syslog->enabled) {
@ -51,6 +51,10 @@ class DolibarrDebugBar extends DebugBar
*/
public function getRenderer()
{
return parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/DebugBar/Resources');
$renderer = parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/DebugBar/Resources');
//$renderer->disableVendor('jquery');
$renderer->disableVendor('fontawesome');
$renderer->disableVendor('highlightjs');
return $renderer;
}
}

View File

@ -1,113 +0,0 @@
<?php
/**
* ActionsDebugBar class
*/
class ActionsDebugBar
{
/**
* Load Debug bar
*
* @return void
*/
protected function loadDebugBar()
{
global $conf, $debugbar;
dol_include_once('/debugbar/class/DebugBar.php');
$debugbar = new DolibarrDebugBar();
$renderer = $debugbar->getRenderer();
$conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
}
/**
* Overloading the afterLogin function
*
* @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
public function afterLogin($parameters, &$object, &$action, $hookmanager)
{
$error = 0; // Error counter
if (in_array('login', explode(':', $parameters['context'])))
{
$this->loadDebugBar();
}
if (! $error)
{
return 0; // or return 1 to replace standard code
}
else
{
return -1;
}
}
/**
* Overloading the updateSession function
*
* @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
public function updateSession($parameters, &$object, &$action, $hookmanager)
{
$error = 0; // Error counter
if (in_array('main', explode(':', $parameters['context'])))
{
$this->loadDebugBar();
}
if (! $error)
{
return 0; // or return 1 to replace standard code
}
else
{
return -1;
}
}
/**
* Overloading the printCommonFooter function
*
* @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int <0 on error, 0 on success, 1 to replace standard code
*/
public function printCommonFooter($parameters, &$object, &$action, $hookmanager)
{
global $user, $debugbar, $langs;
$error = 0; // Error counter
$context = explode(':', $parameters['context']);
if (in_array('main', $context) || in_array('login', $context))
{
if ($user->rights->debugbar->read && is_object($debugbar)) {
$renderer = $debugbar->getRenderer();
echo $renderer->render();
}
}
if (! $error)
{
return 0; // or return 1 to replace standard code
}
else
{
return -1;
}
}
}

View File

@ -372,7 +372,7 @@ if ($action == 'create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
}
print '</tr>' . "\n";

View File

@ -142,7 +142,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->don->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/don/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewDonation').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/don/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewDonation').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
@ -200,7 +200,7 @@ if ($resql)
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
@ -231,7 +231,7 @@ if ($resql)
$donationstatic->firstname=$objp->firstname;
print "<td>".$donationstatic->getNomUrl(1)."</td>";
if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
$company=new Societe($db);
$result=$company->fetch($objp->socid);
if (!empty($objp->socid) && $company->id > 0) {

View File

@ -961,7 +961,7 @@ if ($action == 'create')
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("AddProject") . '</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
print '</tr>';
}

View File

@ -279,7 +279,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->expedition->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create2"><span class="valignmiddle">'.$langs->trans('NewSending').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create2"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewSending').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -26,17 +26,18 @@
* \brief Page for trip and expense report card
*/
$res=0;
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/modules/expensereport/modules_expensereport.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
@ -1090,9 +1091,18 @@ if (empty($reshook))
$error = 0;
// First save uploaded file
if (! empty($_FILES))
$fk_ecm_files = 0;
if (GETPOSTISSET('attachfile'))
{
$arrayoffiles=GETPOST('attachfile', 'array');
if (is_array($arrayoffiles) && ! empty($arrayoffiles[0]))
{
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$relativepath='expensereport/'.$object->ref.'/'.$arrayoffiles[0];
$ecmfiles=new EcmFiles($db);
$ecmfiles->fetch(0, '', $relativepath);
$fk_ecm_files = $ecmfiles->id;
}
}
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
@ -1111,7 +1121,7 @@ if (empty($reshook))
$qty = GETPOST('qty', 'int');
if (empty($qty)) $qty=1;
if (! $fk_c_type_fees > 0)
if (! ($fk_c_type_fees > 0))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
@ -1144,13 +1154,12 @@ if (empty($reshook))
setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings');
}
// S'il y'a eu au moins une erreur
if (! $error)
{
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
// Insert line
$result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type);
$result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type, $fk_ecm_files);
if ($result > 0)
{
$ret = $object->fetch($object->id); // Reload to get new records
@ -1340,6 +1349,7 @@ $formproject = new FormProjets($db);
$projecttmp = new Project($db);
$paymentexpensereportstatic=new PaymentExpenseReport($db);
$bankaccountstatic = new Account($db);
$ecmfilesstatic = new EcmFiles($db);
// Create
if ($action == 'create')
@ -1709,7 +1719,7 @@ else
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
// Author
print '<tr>';
@ -1853,7 +1863,7 @@ else
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
// Amount
print '<tr>';
@ -2020,7 +2030,7 @@ else
if (! empty($conf->projet->enabled)) print '<td class="minwidth100imp">'.$langs->trans('Project').'</td>';
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print '<td>'.$langs->trans('CarCategory').'</td>';
print '<td class="center">'.$langs->trans('Type').'</td>';
print '<td class="left">'.$langs->trans('Description').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td class="right">'.$langs->trans('VAT').'</td>';
print '<td class="right">'.$langs->trans('PriceUHT').'</td>';
print '<td class="right">'.$langs->trans('PriceUTTC').'</td>';
@ -2030,6 +2040,9 @@ else
print '<td class="right">'.$langs->trans('AmountHT').'</td>';
print '<td class="right">'.$langs->trans('AmountTTC').'</td>';
}
// Picture
print '<td>';
print '</td>';
// Ajout des boutons de modification/suppression
if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer)
{
@ -2102,6 +2115,80 @@ else
print '<td class="right">'.price($line->total_ttc).'</td>';
}
// Column with preview
print '<td class="center">';
if ($line->fk_ecm_files > 0)
{
$modulepart='expensereport';
$maxheightmini=32;
$result = $ecmfilesstatic->fetch($line->fk_ecm_files);
if ($result > 0)
{
$relativepath=preg_replace('/expensereport\//', '', $ecmfilesstatic->filepath);
$fileinfo = pathinfo($ecmfilesstatic->filepath.'/'.$ecmfilesstatic->filename);
if (image_format_supported($fileinfo['basename']) > 0)
{
$minifile=getImageFileNameForSize($fileinfo['basename'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original
if (! dol_is_file($conf->expensereport->dir_output.'/'.$relativepath.'/'.$minifile)) $minifile=getImageFileNameForSize($fileinfo['basename'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
//print $file['path'].'/'.$minifile.'<br>';
$urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.'/'.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
if (empty($urlforhref)) {
$urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']));
print '<a href="'.$urlforhref.'" class="aphoto" target="_blank">';
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
print '<img class="photo" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.'/'.$minifile).'" title="">';
print '</a>';
}
else
{
$modulepart='expensereport';
$thumbshown=0;
if (preg_match('/\.pdf$/i', $ecmfilesstatic->filename))
{
$filepdf = $conf->expensereport->dir_output.'/'.$relativepath.'/'.$ecmfilesstatic->filename;
$fileimage = $conf->expensereport->dir_output.'/'.$relativepath.'/'.$ecmfilesstatic->filename.'_preview.png';
$relativepathimage = $relativepath.'/'.$ecmfilesstatic->filename.'_preview.png';
$pdfexists = file_exists($filepdf);
if ($pdfexists)
{
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf)))
{
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png
if ($ret < 0) $error++;
}
}
}
if ($pdfexists && ! $error)
{
$heightforphotref=70;
if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60;
// If the preview file is found
if (file_exists($fileimage))
{
$thumbshown=1;
print '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
}
}
}
if (! $thumbshown)
{
print img_mime($ecmfilesstatic->filename);
}
}
}
}
print '</td>';
// Ajout des boutons de modification/suppression
if (($object->fk_statut < ExpenseReport::STATUS_VALIDATED || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer)
{
@ -2122,72 +2209,77 @@ else
if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int'))
{
print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td></td>';
print '<td></td>';
// Select date
print '<td class="center">';
print $form->selectDate($line->date, 'date');
print '</td>';
// Select date
print '<td class="center">';
print $form->selectDate($line->date, 'date');
print '</td>';
// Select project
if (! empty($conf->projet->enabled))
{
print '<td>';
$formproject->select_projects(-1, $line->fk_project, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
{
print '<td class="fk_c_exp_tax_cat">';
$params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->rowid, 'date' => $line->dates);
print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params);
print '</td>';
}
// Select type
print '<td class="center">';
select_type_fees_id($line->fk_c_type_fees, 'fk_c_type_fees');
print '</td>';
// Add comments
// Select project
if (! empty($conf->projet->enabled))
{
print '<td>';
print '<textarea name="comments" class="flat_ndf centpercent">'.dol_escape_htmltag($line->comments, 0, 1).'</textarea>';
$formproject->select_projects(-1, $line->fk_project, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
// VAT
print '<td class="right">';
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1);
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
{
print '<td class="fk_c_exp_tax_cat">';
$params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->rowid, 'date' => $line->dates);
print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params);
print '</td>';
}
// Unit price
print '<td class="right">';
print '<input type="text" min="0" class="right maxwidth50" id="value_unit_ht" name="value_unit_ht" value="'.dol_escape_htmltag(price2num($line->value_unit_ht)).'" />';
print '</td>';
// Select type
print '<td class="center">';
select_type_fees_id($line->fk_c_type_fees, 'fk_c_type_fees');
print '</td>';
// Unit price with tax
print '<td class="right">';
print '<input type="text" min="0" class="right maxwidth50" id="value_unit" name="value_unit" value="'.dol_escape_htmltag(price2num($line->value_unit)).'" />';
print '</td>';
// Add comments
print '<td>';
print '<textarea name="comments" class="flat_ndf centpercent">'.dol_escape_htmltag($line->comments, 0, 1).'</textarea>';
print '</td>';
// Quantity
print '<td class="right">';
print '<input type="number" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($line->qty).'" />';
print '</td>';
// VAT
print '<td class="right">';
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1);
print '</td>';
if ($action != 'editline')
{
print '<td class="right">'.$langs->trans('AmountHT').'</td>';
print '<td class="right">'.$langs->trans('AmountTTC').'</td>';
}
// Unit price
print '<td class="right">';
print '<input type="text" min="0" class="right maxwidth50" id="value_unit_ht" name="value_unit_ht" value="'.dol_escape_htmltag(price2num($line->value_unit_ht)).'" />';
print '</td>';
print '<td class="center">';
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</td>';
// Unit price with tax
print '<td class="right">';
print '<input type="text" min="0" class="right maxwidth50" id="value_unit" name="value_unit" value="'.dol_escape_htmltag(price2num($line->value_unit)).'" />';
print '</td>';
// Quantity
print '<td class="right">';
print '<input type="number" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($line->qty).'" />';
print '</td>';
if ($action != 'editline')
{
print '<td class="right">'.$langs->trans('AmountHT').'</td>';
print '<td class="right">'.$langs->trans('AmountTTC').'</td>';
}
// Picture
print '<td class="center">';
//print $line->fk_ecm_files;
print '</td>';
print '<td class="center">';
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</td>';
}
$i++;
@ -2197,7 +2289,7 @@ else
// Add a line
if (($object->fk_statut == ExpenseReport::STATUS_DRAFT || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer)
{
$colspan = 10;
$colspan = 11;
if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++;
if (! empty($conf->projet->enabled)) $colspan++;
if ($action != 'editline') $colspan++;
@ -2232,10 +2324,12 @@ else
print '$(document).ready(function() {
$( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle();
jQuery(".trattachnewfilenow").hide();
return false;
});
$( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle();
jQuery(".truploadnewfilenow").hide();
return false;
});';
if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')))
@ -2249,14 +2343,12 @@ else
print '</td></tr>';
// Add line to upload new file
print '<tr class="oddeven truploadnewfilenow"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<tr class="oddeven nohover truploadnewfilenow"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<td colspan="'.$colspan.'">';
$modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer;
$formfile=new FormFile($db);
// We define var to enable the feature to add prefix of uploaded files
$savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
@ -2266,10 +2358,6 @@ else
{
$savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
}
/*if (in_array($modulepart,array('member')))
{
$savingdocmask=$object->login.'___file__';
}*/
}
// Show upload form (document and links)
@ -2305,7 +2393,7 @@ else
$nbLinks=Link::count($db, $object->element, $object->id);
if ($nbFiles >= 0)
{
print '<tr class="oddeven trattachnewfilenow"'.(! GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<tr class="oddeven nohover trattachnewfilenow"'.(! GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<td colspan="'.$colspan.'">';
//print '<span class="opacitymedium">'.$langs->trans("AttachTheNewLineToTheDocument").'</span><br>';
$modulepart='expensereport';$maxheightmini=48;
@ -2316,8 +2404,7 @@ else
$fileinfo = pathinfo($file['name']);
if (image_format_supported($file['name']) > 0)
{
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original
//if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case however) than original
//print $file['path'].'/'.$minifile.'<br>';
$urlforhref=getAdvancedPreviewUrl($modulepart, $fileinfo['relativename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
if (empty($urlforhref)) {
@ -2326,10 +2413,57 @@ else
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
print '<img class="photo" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
print '<div class="photoref">';
print '<img class="photoexpensereport photorefcenter" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
print '</div>';
print '</a>';
}
else print '&nbsp;';
else
{
$modulepart='expensereport';
print '<a href=""><div class="photoref">';
$thumbshown=0;
if (preg_match('/\.pdf$/i', $file['name']))
{
$filepdf = $conf->expensereport->dir_output.'/'.$relativepath.$file['name'];
$fileimage = $conf->expensereport->dir_output.'/'.$relativepath.$file['name'].'_preview.png';
$relativepathimage = $relativepath.$file['name'].'_preview.png';
$pdfexists = file_exists($filepdf);
if ($pdfexists)
{
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf)))
{
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png
if ($ret < 0) $error++;
}
}
}
if ($pdfexists && ! $error)
{
$heightforphotref=70;
if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60;
// If the preview file is found
if (file_exists($fileimage))
{
$thumbshown=1;
print '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
}
}
}
if (! $thumbshown)
{
print img_mime($minifile);
}
print '</div></a>';
}
print '<br>';
$checked='';
//var_dump(GETPOST($file['relativename'])); var_dump($file['relativename']); var_dump($_FILES['userfile']['name']);
@ -2345,7 +2479,7 @@ else
break;
}
}
print '<input type="checkbox"'.$checked.' name="attachfile[]" value="'.$file['relativename'].'"> '.$file['relativename'];
print '<div class="margintoponly"><input type="radio"'.$checked.' name="attachfile[]" value="'.$file['relativename'].'"> '.$file['relativename'].'</div>';
print '</div>';
}
print '</td></tr>';
@ -2363,7 +2497,10 @@ else
print '<td class="right">'.$langs->trans('PriceUHT').'</td>';
print '<td class="right">'.$langs->trans('PriceUTTC').'</td>';
print '<td class="right">'.$langs->trans('Qty').'</td>';
print '<td colspan="3"></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
print '<tr class="oddeven">';
@ -2424,6 +2561,9 @@ else
print '<input type="text" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($qty?$qty:1).'">'; // We must be able to enter decimal qty
print '</td>';
// Picture
print '<td></td>';
if ($action != 'editline')
{
print '<td class="right"></td>';
@ -2649,7 +2789,6 @@ if (GETPOST('modelselected', 'alpha')) {
if ($action != 'presend')
{
/*
* Generate documents
*/
@ -2669,11 +2808,15 @@ if ($action != 'presend')
$somethingshown = $formfile->numoffiles;
}
// Disabled for expensereport, there is no thirdparty on expensereport, so nothing to define the list of other object we can suggest to link to
/*
if ($action != 'create' && $action != 'edit' && ($id || $ref))
{
$linktoelem = $form->showLinkToObjectBlock($object, null, array('expensereport'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
}
*/
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';

View File

@ -971,7 +971,7 @@ class ExpenseReport extends CommonObject
$this->lines=array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx,';
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,';
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
$sql.= ' p.ref as ref_projet, p.title as title_projet';
@ -1010,8 +1010,9 @@ class ExpenseReport extends CommonObject
$deplig->fk_expensereport = $objp->fk_expensereport;
$deplig->fk_c_type_fees = $objp->fk_c_type_fees;
$deplig->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat;
$deplig->fk_projet = $objp->fk_project;
$deplig->fk_projet = $objp->fk_project; // deprecated
$deplig->fk_project = $objp->fk_project;
$deplig->fk_ecm_files = $objp->fk_ecm_files;
$deplig->total_ht = $objp->total_ht;
$deplig->total_tva = $objp->total_tva;
@ -1687,20 +1688,21 @@ class ExpenseReport extends CommonObject
/**
* addline
*
* @param float $qty Qty
* @param double $up Value init
* @param int $fk_c_type_fees Type payment
* @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
* @param string $date Date
* @param string $comments Description
* @param int $fk_project Project id
* @param int $fk_c_exp_tax_cat Car category id
* @param int $type Type line
* @return int <0 if KO, >0 if OK
* @param float $qty Qty
* @param double $up Value init
* @param int $fk_c_type_fees Type payment
* @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
* @param string $date Date
* @param string $comments Description
* @param int $fk_project Project id
* @param int $fk_c_exp_tax_cat Car category id
* @param int $type Type line
* @param int $fk_ecm_files Id of ECM file to link to this expensereport line
* @return int <0 if KO, >0 if OK
*/
public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0)
public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0, $fk_ecm_files = 0)
{
global $conf,$langs,$mysoc;
global $conf, $langs, $mysoc;
dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG);
@ -1750,7 +1752,10 @@ class ExpenseReport extends CommonObject
$this->line->fk_c_type_fees = $fk_c_type_fees;
$this->line->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
$this->line->comments = $comments;
$this->line->fk_projet = $fk_project;
$this->line->fk_projet = $fk_project; // deprecated
$this->line->fk_project = $fk_project;
$this->line->fk_ecm_files = $fk_ecm_files;
$this->applyOffset();
$this->checkRules($type, $seller);
@ -2497,6 +2502,12 @@ class ExpenseReportLine
public $total_tva;
public $total_ttc;
/**
* @var int ID into llx_ecm_files table to link line to attached file
*/
public $fk_ecm_files;
/**
* Constructor
*
@ -2516,7 +2527,7 @@ class ExpenseReportLine
public function fetch($rowid)
{
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
$sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,';
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
@ -2531,8 +2542,8 @@ class ExpenseReportLine
$objp = $this->db->fetch_object($result);
$this->rowid = $objp->rowid;
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->id = $objp->rowid;
$this->ref = $objp->ref;
$this->fk_expensereport = $objp->fk_expensereport;
$this->comments = $objp->comments;
$this->qty = $objp->qty;
@ -2552,6 +2563,7 @@ class ExpenseReportLine
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
$this->fk_ecm_files = $objp->fk_ecm_files;
$this->db->free($result);
} else {
@ -2585,7 +2597,7 @@ class ExpenseReportLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
$sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat)';
$sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
$sql.= " VALUES (".$this->db->escape($this->fk_expensereport).",";
$sql.= " ".$this->db->escape($this->fk_c_type_fees).",";
$sql.= " ".$this->db->escape($this->fk_project>0?$this->fk_project:($this->fk_projet>0?$this->fk_projet:'null')).",";
@ -2599,7 +2611,8 @@ class ExpenseReportLine
$sql.= " ".$this->db->escape($this->total_ttc).",";
$sql.= "'".$this->db->idate($this->date)."',";
$sql.= " '".$this->db->escape($this->rule_warning_message)."',";
$sql.= " ".$this->db->escape($this->fk_c_exp_tax_cat);
$sql.= " ".$this->db->escape($this->fk_c_exp_tax_cat).",";
$sql.= " ".($this->fk_ecm_files > 0 ? $this->fk_ecm_files : 'null');
$sql.= ")";
$resql=$this->db->query($sql);
@ -2645,7 +2658,7 @@ class ExpenseReportLine
* @param ExpenseReportRule $rule object rule to check
* @param int $fk_user user author id
* @param string $mode day|EX_DAY / month|EX_MON / year|EX_YEA to get amount
* @return amount Amount
* @return float Amount
*/
public function getExpAmount(ExpenseReportRule $rule, $fk_user, $mode = 'day')
{
@ -2682,7 +2695,7 @@ class ExpenseReportLine
}
/**
* update
* Update line
*
* @param User $user User
* @return int <0 if KO, >0 if OK

View File

@ -455,7 +455,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->expensereport->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewTrip').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewTrip').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -52,11 +52,11 @@ if (count($export->array_export_code))
{
if ($user->rights->export->creer)
{
print '<a class="butActionNew" href="'.DOL_URL_ROOT.'/exports/export.php?leftmenu=export">'.$langs->trans("NewExport").'<span class="fa fa-plus-circle valignmiddle"></span></a>';
print '<a class="butActionNew" href="'.DOL_URL_ROOT.'/exports/export.php?leftmenu=export"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewExport").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
else
{
print '<a class="butActionNewRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("NewExport").'<span class="fa fa-plus-circle valignmiddle"></span></a>';
print '<a class="butActionNewRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewExport").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
}
print '</div>';

View File

@ -948,7 +948,7 @@ if ($action == 'create')
$numprojet=$formproject->select_projects($soc->id, $projectid, 'projectid');
if ($numprojet==0)
{
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddProject").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
print '</td></tr>';
}
@ -961,7 +961,7 @@ if ($action == 'create')
$numcontrat=$formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1);
if ($numcontrat==0)
{
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddContract").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$soc->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddContract").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
print '</td></tr>';
}

View File

@ -293,7 +293,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->ficheinter->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewIntervention').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewIntervention').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -90,7 +90,7 @@ if (empty($reshook))
$mesg=join(',', $object->errors);
}
}
// conditions de reglement
// terms of the settlement
if ($action == 'setconditions' && $user->rights->societe->creer)
{
$object->fetch($id);
@ -225,7 +225,7 @@ if ($object->id > 0)
print $object->tva_intra;
print '</td></tr>';
// Conditions de reglement par defaut
// Default terms of the settlement
$langs->load('bills');
$form = new Form($db);
print '<tr><td>';

View File

@ -1543,6 +1543,11 @@ class CommandeFournisseur extends CommonOrder
return -1;
}
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
@ -2470,7 +2475,7 @@ class CommandeFournisseur extends CommonOrder
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
{
global $mysoc, $conf;
global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -2478,8 +2483,6 @@ class CommandeFournisseur extends CommonOrder
if ($this->brouillon)
{
$this->db->begin();
// Clean parameters
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
@ -2500,6 +2503,13 @@ class CommandeFournisseur extends CommonOrder
// Check parameters
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva

View File

@ -1616,6 +1616,12 @@ class FactureFournisseur extends CommonInvoice
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
@ -1837,7 +1843,7 @@ class FactureFournisseur extends CommonInvoice
*/
public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
{
global $mysoc;
global $mysoc, $langs;
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$notrigger,$date_start,$date_end,$fk_unit,$pu_ht_devise,$ref_supplier", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -1849,6 +1855,12 @@ class FactureFournisseur extends CommonInvoice
// Check parameters
//if (! is_numeric($pu) || ! is_numeric($qty)) return -1;
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
// Clean parameters
if (empty($vatrate)) $vatrate=0;

View File

@ -200,6 +200,69 @@ if (empty($reshook))
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// Edit Thirdparty
if (! empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $action == 'set_thirdparty' && $user->rights->fournisseur->commande->creer && $object->statut == CommandeFournisseur::STATUS_DRAFT)
{
$new_socid = GETPOST('new_socid', 'int');
if(! empty($new_socid) && $new_socid != $object->thirdparty->id) {
$db->begin();
// Update supplier
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
$sql .= ' SET fk_soc='.$new_socid;
$sql.= ' WHERE fk_soc='.$object->thirdparty->id;
$sql.= ' AND rowid='.$object->id;
$res = $db->query($sql);
if(! $res) $db->rollback();
else {
$db->commit();
// Replace prices for each lines by new supplier prices
foreach($object->lines as $l) {
$sql = 'SELECT price, unitprice, tva_tx, ref_fourn';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql.= ' WHERE fk_product='.$l->fk_product;
$sql.= ' AND fk_soc='.$new_socid;
$sql.= ' ORDER BY unitprice ASC';
$resql = $db->query($sql);
if($resql) {
$num_row = $db->num_rows($resql);
if(empty($num_row)) {
// No product price for this supplier !
$l->subprice = 0;
$l->total_ht = 0;
$l->total_tva = 0;
$l->total_ttc = 0;
$l->ref_supplier = '';
$l->update();
}
else {
// No need for loop to keep best supplier price
$obj = $db->fetch_object($resql);
$l->subprice = $obj->unitprice;
$l->total_ht = $obj->price;
$l->tva_tx = $obj->tva_tx;
$l->total_tva = $l->total_ht * ($obj->tva_tx/100);
$l->total_ttc = $l->total_ht + $l->total_tva;
$l->ref_supplier = $obj->ref_fourn;
$l->update();
}
}
else {
dol_print_error($db);
}
$db->free($resql);
}
$object->update_price();
}
}
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
exit;
}
if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer)
{
$result = $object->set_remise($user, $_POST['remise_percent']);
@ -404,7 +467,7 @@ if (empty($reshook))
$desc = $productsupplier->desc_supplier;
} else $desc = $productsupplier->description;
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
$type = $productsupplier->type;
$price_base_type = ($productsupplier->fourn_price_base_type?$productsupplier->fourn_price_base_type:'HT');
@ -1496,7 +1559,7 @@ if ($action=='create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
print '</td>';
@ -1558,7 +1621,7 @@ if ($action=='create')
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("AddProject") . '</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td></tr>';
}
@ -1826,40 +1889,57 @@ elseif (! empty($object->id))
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
$morehtmlref.='<br>'.$langs->trans('ThirdParty');
if(! empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && ! empty($user->rights->fournisseur->commande->creer) && $action == 'edit_thirdparty') {
$morehtmlref .= ' : ';
$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
$morehtmlref .= '<input type="hidden" name="action" value="set_thirdparty">';
$morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$morehtmlref .= $form->select_company($object->thirdparty->id, 'new_socid', 's.fournisseur = 1', '', 0, 0, array(), 0, 'minwidth300');
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
$morehtmlref .= '</form>';
}
if(empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) || $action != 'edit_thirdparty') {
if(! empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $object->statut == CommandeFournisseur::STATUS_DRAFT) {
$morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=edit_thirdparty&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetThirdParty')) . '</a>';
}
$morehtmlref .= ' : '.$object->thirdparty->getNomUrl(1);
if(empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="' . DOL_URL_ROOT . '/fourn/commande/list.php?socid=' . $object->thirdparty->id . '&search_company=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherOrders") . '</a>)';
}
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
if(!empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
if($user->rights->fournisseur->commande->creer) {
if($action != 'classify')
$morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
$morehtmlref .= '</form>';
}
else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
}
else {
if(!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
}
else {
$morehtmlref .= '';
}
}
}
$morehtmlref.='</div>';
@ -1916,7 +1996,7 @@ elseif (! empty($object->id))
print '</td></tr>';
// Conditions de reglement par defaut
// Default terms of the settlement
$langs->load('bills');
print '<tr><td class="nowrap">';
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';

View File

@ -631,7 +631,7 @@ if ($resql)
$newcardbutton='';
if($user->rights->fournisseur->commande->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewOrder').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewOrder').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -1247,7 +1247,7 @@ if (empty($reshook))
$desc = $productsupplier->desc_supplier;
} else $desc = $productsupplier->description;
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
$type = $productsupplier->type;
$price_base_type = ($productsupplier->fourn_price_base_type?$productsupplier->fourn_price_base_type:'HT');
@ -1756,7 +1756,7 @@ if ($action == 'create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
print '</td></tr>';
@ -2495,7 +2495,7 @@ else
}
print '</td>';
// Conditions de reglement par defaut
// Default terms of the settlement
$langs->load('bills');
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';

View File

@ -466,7 +466,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->fournisseur->facture->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewBill').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewBill').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -1105,7 +1105,7 @@ else
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
print '<tbody>';
// User
@ -1213,7 +1213,7 @@ else
print '<div class="underbanner clearboth"></div>';
// Info workflow
print '<table class="border centpercent">'."\n";
print '<table class="border tableforfield centpercent">'."\n";
print '<tbody>';
if (! empty($object->fk_user_create))

View File

@ -340,7 +340,7 @@ else
$newcardbutton='';
if ($user->rights->holiday->write)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/holiday/card.php?action=request"><span class="valignmiddle">'.$langs->trans('MenuAddCP').'</span>';
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/holiday/card.php?action=request"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuAddCP').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}

View File

@ -38,11 +38,12 @@ if (! $user->admin)
$action=GETPOST('action', 'aZ09');
if ($action == 'setproductionmode')
if ($action == 'set')
{
$status = GETPOST('status', 'alpha');
$res1 = dolibarr_set_const($db, 'IFTTT_SERVICE_KEY', GETPOST('IFTTT_SERVICE_KEY', 'alpha'), 'chaine', 0, '', 0);
$res2 = dolibarr_set_const($db, 'IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', GETPOST('IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', 'alpha'), 'chaine', 0, '', 0);
if (dolibarr_set_const($db, 'IFTTT_PRODUCTION_MODE', $status, 'chaine', 0, '', 0) > 0)
if ($res1 > 0 && $res2)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
@ -66,38 +67,44 @@ print load_fiche_titre($langs->trans("IFTTTSetup"), $linkback, 'title_setup');
print $langs->trans("IFTTTDesc")."<br>\n";
print "<br>\n";
//print '<form name="apisetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<form name="apisetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print "<td>".$langs->trans("Parameter")."</td>";
print '<td class="center">'.$langs->trans("Value")."</td>";
print '<td>'.$langs->trans("Value")."</td>";
print "<td>&nbsp;</td>";
print "</tr>";
print '<tr class="impair">';
print '<td>'.$langs->trans("ProductionMode").'</td>';
$production_mode=(empty($conf->global->IFTTT_PRODUCTION_MODE)?false:true);
if ($production_mode)
{
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
}
else
{
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("IFTTT_SERVICE_KEY").'</td>';
print '<td>';
print '<input type="text" name="IFTTT_SERVICE_KEY" value="'.$conf->global->IFTTT_SERVICE_KEY.'">';
print '</td>';
print '<td>'.$langs->trans("YouWillFindItOnYourIFTTTAccount").'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("IFTTT_DOLIBARR_ENDPOINT_SECUREKEY").'</td>';
print '<td>';
print '<input type="text" name="IFTTT_DOLIBARR_ENDPOINT_SECUREKEY" value="'.$conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY.'">';
print '</td>';
print '<td>'.$langs->trans("DefineAValueOfYourChoice").'</td>';
print '</tr>';
print '</table>';
print '<div class="center">';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br><br>';
/*
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
@ -106,26 +113,13 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
// Show message
$message='';
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
$url=$urlwithroot.'/ifttt/index.php?securekey='.$conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY;
$message.=$langs->trans("UrlForIFTTT").':<br>';
$message.=img_picto('', 'object_globe.png').' '.$url;
print $message;
print '<br>';
print '<br>';
// Explorer
print '<u>'.$langs->trans("ApiExporerIs").':</u><br>';
if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer'))
{
$url=DOL_MAIN_URL_ROOT.'/api/index.php/explorer';
print img_picto('', 'object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
}
else
{
print $langs->trans("NotAvailableWithThisDistribution");
}
*/
llxFooter();
$db->close();

View File

@ -92,7 +92,7 @@ if (count($import->array_import_code))
{
//if ($user->rights->import->run)
//{
print '<a class="butActionNew" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import">'.$langs->trans("NewImport").'<span class="fa fa-plus-circle valignmiddle"></span></a>';
print '<a class="butActionNew" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewImport").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
//}
//else
//{

View File

@ -9,6 +9,7 @@
-- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de>
-- Copyright (C) 2012 Ricardo Schluter <info@ripasch.nl>
-- Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
-- Copyright (C) 2019~ Lao Tian <281388879@qq.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -352,3 +353,39 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES (25
-- Regions Slovenia (rowid country=202)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ('202', '20203', 'SI03', NULL, 'East Slovenia');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ('202', '20204', 'SI04', NULL, 'West Slovenia');
-- Regions China (rowid country=9)
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,901, '',0,'北京市');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,902, '',0,'天津市');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,903, '',0,'上海市');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,904, '',0,'重庆市');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,905, '',0,'河北省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,906, '',0,'山西省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,907, '',0,'辽宁省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,908, '',0,'吉林省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,909, '',0,'黑龙江省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,910, '',0,'江苏省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,911, '',0,'浙江省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,912, '',0,'安徽省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,913, '',0,'福建省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,914, '',0,'江西省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,915, '',0,'山东省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,916, '',0,'河南省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,917, '',0,'湖北省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,918, '',0,'湖南省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,919, '',0,'广东省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,920, '',0,'海南省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,921, '',0,'四川省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,922, '',0,'贵州省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,923, '',0,'云南省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,924, '',0,'陕西省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,925, '',0,'甘肃省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,926, '',0,'青海省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,927, '',0,'台湾省');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,928, '',0,'内蒙古自治区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,929, '',0,'广西壮族自治区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,930, '',0,'西藏自治区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,931, '',0,'宁夏回族自治区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,932, '',0,'新疆维吾尔自治区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,933, '',0,'香港特别行政区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,934, '',0,'澳门特别行政区');

Some files were not shown because too many files have changed in this diff Show More