Merge branch 'develop' into dev_sign_soeciete_rib

This commit is contained in:
HENRY Florian 2023-09-05 19:17:11 +02:00 committed by GitHub
commit ed1e8a825d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 896 additions and 516 deletions

View file

@ -60,3 +60,4 @@ jobs:
#committer_email: eldy@destailleur.fr
message: 'PHP CS fixer github action'
add: '*.php'

View file

@ -325,22 +325,24 @@ script:
echo
- |
echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)"
echo "Checking coding style (only for 1 version to not overload travis and avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
#if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi
set +e
echo
- |
echo "Checking missing debug"
echo "Checking missing debug (only for 1 version to not overload travis and avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
#if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
fi
set +e

View file

@ -54,6 +54,38 @@ $rowid = GETPOST('rowid', 'alpha');
$entity = GETPOST('entity', 'int');
$code = GETPOST('code', 'alpha');
$acts = array(); $actl = array();
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
// Load variable for pagination
$listoffset = GETPOST('listoffset');
$listlimit = GETPOST('listlimit') > 0 ?GETPOST('listlimit') : 1000; // To avoid too long dictionaries
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $listlimit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$search_country_id = GETPOST('search_country_id', 'int');
$search_code = GETPOST('search_code', 'alpha');
$search_active = GETPOST('search_active', 'alpha');
// Special case to set a default value for country according to dictionary
if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) { // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
$search_country_id = $mysoc->country_id;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin', 'dictionaryadmin'));
$allowed = $user->admin;
if ($id == 7 && $user->hasRight('accounting', 'chartofaccount')) {
$allowed = 1; // Tax page allowed to manager of chart account
@ -68,34 +100,8 @@ if (!$allowed) {
accessforbidden();
}
$acts = array(); $actl = array();
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
$permissiontoadd = $allowed;
$listoffset = GETPOST('listoffset');
$listlimit = GETPOST('listlimit') > 0 ?GETPOST('listlimit') : 1000; // To avoid too long dictionaries
$active = 1;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $listlimit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$search_country_id = GETPOST('search_country_id', 'int');
if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) { // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
$search_country_id = $mysoc->country_id;
}
$search_code = GETPOST('search_code', 'alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin', 'dictionaryadmin'));
// This page is a generic page to edit dictionaries
// Put here declaration of dictionaries properties
@ -201,7 +207,7 @@ $tablib[44] = "DictionaryAssetDisposalType";
$tabsql = array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
@ -670,6 +676,7 @@ $localtax_typeList = array(
);
/*
* Actions
*/
@ -702,6 +709,7 @@ if ($reshook < 0) {
if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
$search_country_id = '';
$search_code = '';
$search_active = '';
}
if (empty($reshook)) {
@ -746,9 +754,9 @@ if (empty($reshook)) {
&& ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10
)
) {
$ok = 0;
$fieldnamekey = $value;
// We take translate key of field
$ok = 0;
$fieldnamekey = $value;
// We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
$fieldnamekey = 'Label';
}
@ -823,7 +831,7 @@ if (empty($reshook)) {
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
}
}
if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) {
if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code")) && GETPOST('actionadd')) {
$ok = 0;
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors');
}
@ -998,6 +1006,13 @@ if (empty($reshook)) {
setEventMessages($db->error(), null, 'errors');
}
}
if (!$ok && GETPOST('actionadd')) {
$action = 'create';
}
if (!$ok && GETPOST('actionmodify')) {
$action = 'edit';
}
}
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
@ -1168,7 +1183,6 @@ if (empty($reshook)) {
*/
$form = new Form($db);
$formadmin = new FormAdmin($db);
$title = $langs->trans("DictionarySetup");
@ -1189,22 +1203,16 @@ if ($id == 7 && GETPOST('from') == 'accountancy') {
$titlepicto = 'accountancy';
}
print load_fiche_titre($title, $linkback, $titlepicto);
if (empty($id)) {
print '<span class="opacitymedium">'.$langs->trans("DictionaryDesc");
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
print '</span><br>';
}
$param = '&id='.urlencode($id);
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
if ($search_country_id || GETPOSTISSET('page') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
$param .= '&search_country_id='.urlencode($search_country_id ? $search_country_id : -1);
}
if ($search_code != '') {
$param .= '&search_code='.urlencode($search_code);
}
if ($search_active != '') {
$param .= '&search_active='.urlencode($search_active);
}
if ($entity != '') {
$param .= '&entity='.(int) $entity;
}
@ -1225,37 +1233,55 @@ if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'rowid='.urlencode($rowid).'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
/*
* Show a dictionary
*/
// Show a dictionary
if ($id > 0) {
// Complete search values request with sort criteria
$sql = $tabsql[$id];
$sqlfields = $tabsql[$id];
$tablecode = '';
$tableprefix = '';
$tableprefixarray = array(9 => 'code_iso', 28 => 'h.code', 7 => 'a.code', 32 => 'a.code', 3 => 'r.code_region', 8 => 't.code', 10 => 't.code', 1 => 'f.code', 2 => 'd.code_departement', 14 => 'e.code');
if (!empty($tableprefixarray[$id])) {
$tablecode = $tableprefixarray[$id];
$tableprefix = preg_replace('/\..*$/', '.', $tablecode);
}
$sql = $sqlfields;
if (!preg_match('/ WHERE /', $sql)) {
$sql .= " WHERE 1 = 1";
}
if ($search_country_id > 0) {
$sql .= " AND c.rowid = ".((int) $search_country_id);
}
if ($search_code != '' && $id == 9) {
$sql .= natural_search("code_iso", $search_code);
} elseif ($search_code != '' && $id == 28) {
$sql .= natural_search("h.code", $search_code);
} elseif ($search_code != '' && ($id == 7 || $id == 32)) {
$sql .= natural_search("a.code", $search_code);
} elseif ($search_code != '' && $id == 3) {
$sql .= natural_search("r.code_region", $search_code);
} elseif ($search_code != '' && ($id == 8 || $id == 10)) {
$sql .= natural_search("t.code", $search_code);
} elseif ($search_code != '' && $id == 1) {
$sql .= natural_search("f.code", $search_code);
} elseif ($search_code != '' && $id == 2) {
$sql .= natural_search("d.code_departement", $search_code);
} elseif ($search_code != '' && $id == 14) {
$sql .= natural_search("e.code", $search_code);
} elseif ($search_code != '' && $id != 9) {
$sql .= natural_search("code", $search_code);
if ($search_code != '') {
$sql .= natural_search($tablecode, $search_code);
}
if ($search_active == 'yes') {
$sql .= " AND ".$tableprefix."active = 1";
} elseif ($search_active == 'no') {
$sql .= " AND ".$tableprefix."active = 0";
}
//print $sql;
// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^.*\sFROM\s/', 'SELECT COUNT(*) as nbtotalofrecords FROM ', $sql);
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount);
if ($resql) {
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
$db->free($resql);
}
if ($sortfield) {
@ -1272,7 +1298,16 @@ if ($id > 0) {
$sql .= " ORDER BY ";
}
$sql .= $tabsqlsort[$id];
$sql .= $db->plimit($listlimit + 1, $offset);
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
//print $sql;
if (empty($tabfield[$id])) {
@ -1285,327 +1320,12 @@ if ($id > 0) {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
// Special warning for VAT dictionary
if ($id == 10 && empty($conf->global->FACTURE_TVAOPTION)) {
print info_admin($langs->trans("VATIsUsedIsOff", $langs->transnoentities("Setup"), $langs->transnoentities("CompanyFoundation")));
print "<br>\n";
}
// Form to add a new line
if ($tabname[$id]) {
$withentity = null;
$fieldlist = explode(',', $tabfield[$id]);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
// Line for title
print '<!-- line title to add new entry -->';
$tdsoffields = '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
$withentity = getEntity($tabname[$id]);
continue;
}
// Define field friendly name from its technical name
$valuetoshow = ucfirst($value); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = '';
if ($value == 'pos') {
$valuetoshow = $langs->trans("Position"); $class = 'right';
}
if ($value == 'source') {
$valuetoshow = $langs->trans("Contact");
}
if ($value == 'price') {
$valuetoshow = $langs->trans("PriceUHT");
}
if ($value == 'taux') {
if ($tabname[$id] != "c_revenuestamp") {
$valuetoshow = $langs->trans("Rate");
} else {
$valuetoshow = $langs->trans("Amount");
}
$class = 'center';
}
if ($value == 'localtax1_type') {
$valuetoshow = $langs->trans("UseLocalTax")." 2"; $class = "center"; $sortable = 0;
}
if ($value == 'localtax1') {
$valuetoshow = $langs->trans("RateOfTaxN", '2'); $class = "center";
}
if ($value == 'localtax2_type') {
$valuetoshow = $langs->trans("UseLocalTax")." 3"; $class = "center"; $sortable = 0;
}
if ($value == 'localtax2') {
$valuetoshow = $langs->trans("RateOfTaxN", '3'); $class = "center";
}
if ($value == 'organization') {
$valuetoshow = $langs->trans("Organization");
}
if ($value == 'lang') {
$valuetoshow = $langs->trans("Language");
}
if ($value == 'type') {
if ($tabname[$id] == "c_paiement") {
$valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else {
$valuetoshow = $langs->trans("Type");
}
}
if ($value == 'code') {
$valuetoshow = $langs->trans("Code"); $class = 'maxwidth100';
}
if ($value == 'libelle' || $value == 'label') {
$valuetoshow = $form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
}
if ($value == 'libelle_facture') {
$valuetoshow = $form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
}
if ($value == 'deposit_percent') {
$valuetoshow = $langs->trans('DepositPercent');
$class = 'right';
}
if ($value == 'country') {
if (in_array('region_id', $fieldlist)) {
print '<td>&nbsp;</td>'; continue;
} // For region page, we do not show the country input
$valuetoshow = $langs->trans("Country");
}
if ($value == 'recuperableonly') {
$valuetoshow = $langs->trans("NPR"); $class = "center";
}
if ($value == 'nbjour') {
$valuetoshow = $langs->trans("NbOfDays");
$class = 'right';
}
if ($value == 'type_cdr') {
$valuetoshow = $langs->trans("AtEndOfMonth"); $class = "center";
}
if ($value == 'decalage') {
$valuetoshow = $langs->trans("Offset");
$class = 'right';
}
if ($value == 'width' || $value == 'nx') {
$valuetoshow = $langs->trans("Width");
}
if ($value == 'height' || $value == 'ny') {
$valuetoshow = $langs->trans("Height");
}
if ($value == 'unit' || $value == 'metric') {
$valuetoshow = $langs->trans("MeasuringUnit");
}
if ($value == 'region_id' || $value == 'country_id') {
$valuetoshow = '';
}
if ($value == 'accountancy_code') {
$valuetoshow = $langs->trans("AccountancyCode");
}
if ($value == 'accountancy_code_sell') {
$valuetoshow = $langs->trans("AccountancyCodeSell");
}
if ($value == 'accountancy_code_buy') {
$valuetoshow = $langs->trans("AccountancyCodeBuy");
}
if ($value == 'pcg_version' || $value == 'fk_pcg_version') {
$valuetoshow = $langs->trans("Pcg_version");
}
if ($value == 'account_parent') {
$valuetoshow = $langs->trans("Accountparent");
}
if ($value == 'pcg_type') {
$valuetoshow = $langs->trans("Pcg_type");
}
if ($value == 'pcg_subtype') {
$valuetoshow = $langs->trans("Pcg_subtype");
}
if ($value == 'sortorder') {
$valuetoshow = $langs->trans("SortOrder");
$class = 'center';
}
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
}
if ($value == 'fk_parent') {
$valuetoshow = $langs->trans("ParentID"); $class = 'center';
}
if ($value == 'range_account') {
$valuetoshow = $langs->trans("Range");
}
if ($value == 'sens') {
$valuetoshow = $langs->trans("Sens");
}
if ($value == 'category_type') {
$valuetoshow = $langs->trans("Calculated");
}
if ($value == 'formula') {
$valuetoshow = $langs->trans("Formula");
}
if ($value == 'paper_size') {
$valuetoshow = $langs->trans("PaperSize");
}
if ($value == 'orientation') {
$valuetoshow = $langs->trans("Orientation");
}
if ($value == 'leftmargin') {
$valuetoshow = $langs->trans("LeftMargin");
}
if ($value == 'topmargin') {
$valuetoshow = $langs->trans("TopMargin");
}
if ($value == 'spacex') {
$valuetoshow = $langs->trans("SpaceX");
}
if ($value == 'spacey') {
$valuetoshow = $langs->trans("SpaceY");
}
if ($value == 'font_size') {
$valuetoshow = $langs->trans("FontSize");
}
if ($value == 'custom_x') {
$valuetoshow = $langs->trans("CustomX");
}
if ($value == 'custom_y') {
$valuetoshow = $langs->trans("CustomY");
}
if ($value == 'percent') {
$valuetoshow = $langs->trans("Percentage");
}
if ($value == 'affect') {
$valuetoshow = $langs->trans("WithCounter");
}
if ($value == 'delay') {
$valuetoshow = $langs->trans("NoticePeriod");
}
if ($value == 'newbymonth') {
$valuetoshow = $langs->trans("NewByMonth");
}
if ($value == 'fk_tva') {
$valuetoshow = $langs->trans("VAT");
}
if ($value == 'range_ik') {
$valuetoshow = $langs->trans("RangeIk");
}
if ($value == 'fk_c_exp_tax_cat') {
$valuetoshow = $langs->trans("CarCategory");
}
if ($value == 'revenuestamp_type') {
$valuetoshow = $langs->trans('TypeOfRevenueStamp');
}
if ($value == 'use_default') {
$valuetoshow = $langs->trans('Default'); $class = 'center';
}
if ($value == 'unit_type') {
$valuetoshow = $langs->trans('TypeOfUnit');
}
if ($value == 'public' && $tablib[$id] == 'TicketDictCategory') {
$valuetoshow = $langs->trans('TicketGroupIsPublic'); $class = 'center';
}
if ($value == 'block_if_negative') {
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
}
if ($value == 'type_duration') {
$valuetoshow = $langs->trans('Unit');
}
if ($id == 2) { // Special case for state page
if ($value == 'region_id') {
$valuetoshow = '&nbsp;'; $showfield = 1;
}
if ($value == 'region') {
$valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region"); $showfield = 1;
}
}
if ($valuetoshow != '') {
$tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : '');
$tdsoffields .= '<th'.($class ? ' class="'.$class.'"' : '').'>';
if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) {
$tdsoffields .= '<a href="'.$tooltiphelp.'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif ($tooltiphelp) {
$tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
} else {
$tdsoffields .= $valuetoshow;
}
$tdsoffields .= '</th>';
}
}
if ($id == 4) {
$tdsoffields .= '<th></th>';
$tdsoffields .= '<th></th>';
}
$tdsoffields .= '<th>';
$tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">';
if (!is_null($withentity)) {
$tdsoffields .= '<input type="hidden" name="entity" value="'.$withentity.'">';
}
$tdsoffields .= '</th>';
$tdsoffields .= '<th style="min-width: 26px;"></th>';
$tdsoffields .= '<th style="min-width: 26px;"></th>';
$tdsoffields .= '</tr>';
print $tdsoffields;
// Line to enter new values
print '<!-- line input to add new entry -->';
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd')) {
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '') {
$obj->$val = GETPOST($val);
}
}
}
$tmpaction = 'create';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if ($id == 3) {
unset($fieldlist[2]); // Remove field ??? if dictionary Regions
}
if (empty($reshook)) {
fieldList($fieldlist, $obj, $tabname[$id], 'add');
}
if ($id == 4) {
print '<td></td>';
print '<td></td>';
}
print '<td colspan="3" class="center">';
if ($action != 'edit') {
print '<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans("Add").'">';
} else {
print '<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
print "</tr>";
print '</table>';
print '</div>';
}
print '</form>';
print '<br>';
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
@ -1614,12 +1334,336 @@ if ($id > 0) {
$num = $db->num_rows($resql);
$i = 0;
// There is several pages
if (($num > $listlimit) || $page) {
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '<div class="clearboth"></div>';
$massactionbutton = $linkback;
$newcardbutton = '';
/*$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
*/
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/admin/dict.php?action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'tools', 0, $newcardbutton, '', $listlimit, 1, 0, 1);
if ($action == 'create') {
// Form to add a new line
if ($tabname[$id]) {
$withentity = null;
$fieldlist = explode(',', $tabfield[$id]);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
// Line for title
print '<!-- line title to add new entry -->';
$tdsoffields = '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
$withentity = getEntity($tabname[$id]);
continue;
}
// Define field friendly name from its technical name
$valuetoshow = ucfirst($value); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = '';
if ($value == 'pos') {
$valuetoshow = $langs->trans("Position"); $class = 'right';
}
if ($value == 'source') {
$valuetoshow = $langs->trans("Contact");
}
if ($value == 'price') {
$valuetoshow = $langs->trans("PriceUHT");
}
if ($value == 'taux') {
if ($tabname[$id] != "c_revenuestamp") {
$valuetoshow = $langs->trans("Rate");
} else {
$valuetoshow = $langs->trans("Amount");
}
$class = 'center';
}
if ($value == 'localtax1_type') {
$valuetoshow = $langs->trans("UseLocalTax")." 2"; $class = "center"; $sortable = 0;
}
if ($value == 'localtax1') {
$valuetoshow = $langs->trans("RateOfTaxN", '2'); $class = "center";
}
if ($value == 'localtax2_type') {
$valuetoshow = $langs->trans("UseLocalTax")." 3"; $class = "center"; $sortable = 0;
}
if ($value == 'localtax2') {
$valuetoshow = $langs->trans("RateOfTaxN", '3'); $class = "center";
}
if ($value == 'organization') {
$valuetoshow = $langs->trans("Organization");
}
if ($value == 'lang') {
$valuetoshow = $langs->trans("Language");
}
if ($value == 'type') {
if ($tabname[$id] == "c_paiement") {
$valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else {
$valuetoshow = $langs->trans("Type");
}
}
if ($value == 'code') {
$valuetoshow = $langs->trans("Code"); $class = 'maxwidth100';
}
if ($value == 'libelle' || $value == 'label') {
$valuetoshow = $form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
}
if ($value == 'libelle_facture') {
$valuetoshow = $form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
}
if ($value == 'deposit_percent') {
$valuetoshow = $langs->trans('DepositPercent');
$class = 'right';
}
if ($value == 'country') {
if (in_array('region_id', $fieldlist)) {
//print '<td>&nbsp;</td>';
continue;
} // For region page, we do not show the country input
$valuetoshow = $langs->trans("Country");
}
if ($value == 'recuperableonly') {
$valuetoshow = $langs->trans("NPR"); $class = "center";
}
if ($value == 'nbjour') {
$valuetoshow = $langs->trans("NbOfDays");
$class = 'right';
}
if ($value == 'type_cdr') {
$valuetoshow = $langs->trans("AtEndOfMonth"); $class = "center";
}
if ($value == 'decalage') {
$valuetoshow = $langs->trans("Offset");
$class = 'right';
}
if ($value == 'width' || $value == 'nx') {
$valuetoshow = $langs->trans("Width");
}
if ($value == 'height' || $value == 'ny') {
$valuetoshow = $langs->trans("Height");
}
if ($value == 'unit' || $value == 'metric') {
$valuetoshow = $langs->trans("MeasuringUnit");
}
if ($value == 'region_id' || $value == 'country_id') {
$valuetoshow = '';
}
if ($value == 'accountancy_code') {
$valuetoshow = $langs->trans("AccountancyCode");
}
if ($value == 'accountancy_code_sell') {
$valuetoshow = $langs->trans("AccountancyCodeSell");
}
if ($value == 'accountancy_code_buy') {
$valuetoshow = $langs->trans("AccountancyCodeBuy");
}
if ($value == 'pcg_version' || $value == 'fk_pcg_version') {
$valuetoshow = $langs->trans("Pcg_version");
}
if ($value == 'account_parent') {
$valuetoshow = $langs->trans("Accountparent");
}
if ($value == 'pcg_type') {
$valuetoshow = $langs->trans("Pcg_type");
}
if ($value == 'pcg_subtype') {
$valuetoshow = $langs->trans("Pcg_subtype");
}
if ($value == 'sortorder') {
$valuetoshow = $langs->trans("SortOrder");
$class = 'center';
}
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
}
if ($value == 'fk_parent') {
$valuetoshow = $langs->trans("ParentID"); $class = 'center';
}
if ($value == 'range_account') {
$valuetoshow = $langs->trans("Range");
}
if ($value == 'sens') {
$valuetoshow = $langs->trans("Sens");
}
if ($value == 'category_type') {
$valuetoshow = $langs->trans("Calculated");
}
if ($value == 'formula') {
$valuetoshow = $langs->trans("Formula");
}
if ($value == 'paper_size') {
$valuetoshow = $langs->trans("PaperSize");
}
if ($value == 'orientation') {
$valuetoshow = $langs->trans("Orientation");
}
if ($value == 'leftmargin') {
$valuetoshow = $langs->trans("LeftMargin");
}
if ($value == 'topmargin') {
$valuetoshow = $langs->trans("TopMargin");
}
if ($value == 'spacex') {
$valuetoshow = $langs->trans("SpaceX");
}
if ($value == 'spacey') {
$valuetoshow = $langs->trans("SpaceY");
}
if ($value == 'font_size') {
$valuetoshow = $langs->trans("FontSize");
}
if ($value == 'custom_x') {
$valuetoshow = $langs->trans("CustomX");
}
if ($value == 'custom_y') {
$valuetoshow = $langs->trans("CustomY");
}
if ($value == 'percent') {
$valuetoshow = $langs->trans("Percentage");
}
if ($value == 'affect') {
$valuetoshow = $langs->trans("WithCounter");
}
if ($value == 'delay') {
$valuetoshow = $langs->trans("NoticePeriod");
}
if ($value == 'newbymonth') {
$valuetoshow = $langs->trans("NewByMonth");
}
if ($value == 'fk_tva') {
$valuetoshow = $langs->trans("VAT");
}
if ($value == 'range_ik') {
$valuetoshow = $langs->trans("RangeIk");
}
if ($value == 'fk_c_exp_tax_cat') {
$valuetoshow = $langs->trans("CarCategory");
}
if ($value == 'revenuestamp_type') {
$valuetoshow = $langs->trans('TypeOfRevenueStamp');
}
if ($value == 'use_default') {
$valuetoshow = $langs->trans('Default'); $class = 'center';
}
if ($value == 'unit_type') {
$valuetoshow = $langs->trans('TypeOfUnit');
}
if ($value == 'public' && $tablib[$id] == 'TicketDictCategory') {
$valuetoshow = $langs->trans('TicketGroupIsPublic'); $class = 'center';
}
if ($value == 'block_if_negative') {
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
}
if ($value == 'type_duration') {
$valuetoshow = $langs->trans('Unit');
}
if ($id == 2) { // Special case for state page
if ($value == 'region_id') {
$valuetoshow = '&nbsp;';
$showfield = 1;
}
if ($value == 'region') {
$valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region");
$showfield = 1;
}
}
if ($valuetoshow != '') {
$tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : '');
$tdsoffields .= '<th'.($class ? ' class="'.$class.'"' : '').'>';
if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) {
$tdsoffields .= '<a href="'.$tooltiphelp.'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif ($tooltiphelp) {
$tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
} else {
$tdsoffields .= $valuetoshow;
}
$tdsoffields .= '</th>';
}
}
if ($id == 4) {
$tdsoffields .= '<th></th>';
$tdsoffields .= '<th></th>';
}
$tdsoffields .= '<th>';
$tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">';
if (!is_null($withentity)) {
$tdsoffields .= '<input type="hidden" name="entity" value="'.$withentity.'">';
}
$tdsoffields .= '</th>';
$tdsoffields .= '<th style="min-width: 26px;"></th>';
$tdsoffields .= '<th style="min-width: 26px;"></th>';
$tdsoffields .= '</tr>';
print $tdsoffields;
// Line to enter new values
print '<!-- line input to add new entry -->';
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd')) {
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '') {
$obj->$val = GETPOST($val);
}
}
}
$tmpaction = 'create';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if ($id == 3) {
unset($fieldlist[2]); // Remove field ??? if dictionary Regions
}
if (empty($reshook)) {
fieldList($fieldlist, $obj, $tabname[$id], 'add');
}
if ($id == 4) {
print '<td></td>';
print '<td></td>';
}
print '<td colspan="3" class="center">';
if ($action != 'edit') {
print '<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans("Add").'">';
} else {
print '<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
print "</tr>";
print '</table>';
print '</div>';
}
print '</form>';
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
}
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
@ -1673,7 +1717,7 @@ if ($id > 0) {
if ($showfield) {
if ($value == 'country') {
print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone', '', '&nbsp;');
print '</td>';
$colspan++;
} elseif ($value == 'code') {
@ -1695,7 +1739,10 @@ if ($id > 0) {
$colspan++;
}
print '<td class="liste_titre"></td>';
// Active
print '<td class="liste_titre center">';
print $form->selectyesno('search_active', $search_active, 0, false, 1);
print '</td>';
$colspan++;
// Action button
@ -2009,7 +2056,9 @@ if ($id > 0) {
if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) {
$rowidcol = 'rowid';
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder;
$url .= '&rowid='.(isset($obj->$rowidcol) ? $obj->$rowidcol : (!empty($obj->code) ? urlencode($obj->code) : ''));
$url .= '&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if (!empty($param)) {
$url .= '&'.$param;
}
@ -2230,8 +2279,6 @@ if ($id > 0) {
$langs->load('other');
$key = $langs->trans($obj->label);
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
} elseif ($value == 'code' && $id == 3) {
$valuetoshow = $obj->state_code;
} elseif ($value == 'label' && $tabname[$id] == 'c_product_nature') {
$langs->load("products");
$valuetoshow = $langs->trans($obj->{$value});
@ -2347,6 +2394,11 @@ if ($id > 0) {
/*
* Show list of dictionary to show
*/
print load_fiche_titre($title, $linkback, $titlepicto);
print '<span class="opacitymedium">'.$langs->trans("DictionaryDesc");
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
print '</span><br>';
$lastlineisempty = false;

View file

@ -102,7 +102,7 @@ class Availabilities extends CommonObject
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),

View file

@ -300,6 +300,11 @@ class ActionComm extends CommonObject
*/
public $elementtype;
/**
* @var int id of availability
*/
public $fk_bookcal_availability;
/**
* @var string Ical name
*/
@ -539,6 +544,7 @@ class ActionComm extends CommonObject
$sql .= "transparency,";
$sql .= "fk_element,";
$sql .= "elementtype,";
$sql .= "fk_bookcal_availability,";
$sql .= "entity,";
$sql .= "extraparams,";
// Fields emails
@ -581,6 +587,7 @@ class ActionComm extends CommonObject
$sql .= "'".$this->db->escape($this->transparency)."', ";
$sql .= (!empty($this->fk_element) ? ((int) $this->fk_element) : "null").", ";
$sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", ";
$sql .= (!empty($this->fk_bookcal_availability) ? "'".$this->db->escape($this->fk_bookcal_availability)."'" : "null").", ";
$sql .= ((int) $conf->entity).",";
$sql .= (!empty($this->extraparams) ? "'".$this->db->escape($this->extraparams)."'" : "null").", ";
// Fields emails

View file

@ -557,6 +557,34 @@ if ($user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allac
$s = ''; $link = '';
$showextcals = $listofextcals;
$bookcalcalendars = array();
// Load Bookcal Calendars
if (isModEnabled("bookcal")) {
$sql = "SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
$sql .= " FROM ".MAIN_DB_PREFIX."bookcal_availabilities as ba";
$sql .= " JOIN ".MAIN_DB_PREFIX."bookcal_calendar as bc";
$sql .= " ON bc.rowid = ba.fk_bookcal_calendar";
$sql .= " WHERE bc.status = 1";
$sql .= " AND ba.status = 1";
if (!empty($filtert) && $filtert != -1) {
$sql .= " AND bc.visibility = ".(int) $filtert ;
}
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($resql);
$label = !empty($objp->label) ? $objp->label : $objp->ref;
$bookcalcalendars["calendars"][] = array("id" => $objp->id_cal, "label" => $label);
$bookcalcalendars["availabilitieslink"][$objp->rowid] = $objp->id_cal;
$i++;
}
} else {
dol_print_error($db);
}
}
if (!empty($conf->use_javascript_ajax)) { // If javascript on
$s .= "\n".'<!-- Div to calendars selectors -->'."\n";
@ -564,6 +592,11 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
$s .= 'jQuery(document).ready(function () {'."\n";
$s .= 'jQuery(".check_birthday").click(function() { console.log("Toggle birthdays"); jQuery(".family_birthday").toggle(); });'."\n";
$s .= 'jQuery(".check_holiday").click(function() { console.log("Toggle holidays"); jQuery(".family_holiday").toggle(); });'."\n";
if (isModEnabled("bookcal")) {
foreach ($bookcalcalendars["calendars"] as $key => $value) {
$s .= 'jQuery(".check_bookcal_calendar_'.$value['id'].'").click(function() { console.log("Toggle Bookcal Calendar '.$value['id'].'"); jQuery(".family_bookcal_calendar_'.$value['id'].'").toggle(); });'."\n";
}
}
if ($mode == "show_week" || $mode == "show_month" || empty($mode)) {
// Code to enable drag and drop
$s .= 'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'."\n";
@ -631,6 +664,14 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
// Birthdays
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_birthday" name="check_birthday" class="check_birthday"><label for="check_birthday"> <span class="check_birthday_text">'.$langs->trans("AgendaShowBirthdayEvents").'</span></label> &nbsp; </div>';
// Bookcal Calendar
if (isModEnabled("bookcal")) {
foreach ($bookcalcalendars["calendars"] as $key => $value) {
$label = $value['label'];
$s .= '<div class="nowrap inline-block minheight30"><input '.(GETPOST('check_bookcal_calendar_'.$value['id']) ? "checked" : "").' type="checkbox" id="check_bookcal_calendar_'.$value['id'].'" name="check_bookcal_calendar_'.$value['id'].'" class="check_bookcal_calendar_'.$value['id'].'"><label for="check_bookcal_calendar_'.$value['id'].'"> <span class="check_bookcal_calendar_'.$value['id'].'_text">'.$langs->trans("AgendaShowBookcalCalendar", $label).'</span></label> &nbsp; </div>';
}
}
// Calendars from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
@ -673,7 +714,7 @@ $sql .= ' a.datep2,';
$sql .= ' a.percent,';
$sql .= ' a.fk_user_author,a.fk_user_action,';
$sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql .= ' a.fk_soc, a.fk_contact, a.fk_project,';
$sql .= ' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_availability,';
$sql .= ' a.fk_element, a.elementtype,';
$sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
@ -862,6 +903,10 @@ if ($resql) {
$event->socid = $obj->fk_soc;
$event->contact_id = $obj->fk_contact;
$event->fk_bookcal_availability = $obj->fk_bookcal_availability;
if (!empty($event->fk_bookcal_availability)) {
$event->type = "bookcal_calendar";
}
// Defined date_start_in_calendar and date_end_in_calendar property
// They are date start and end of action but modified to not be outside calendar view.
@ -1505,7 +1550,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
}
//var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style);
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam, 0, 60, 0, $bookcalcalendars);
echo "</td>\n";
} else {
/* Show days after the current month (next month) */
@ -1578,7 +1623,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
}
echo ' <td class="'.$style.'" width="14%" valign="top">';
show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
echo " </td>\n";
}
echo " </tr>\n";
@ -1668,13 +1713,13 @@ if (empty($mode) || $mode == 'show_month') { // View by month
echo '</div></div>';
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1);
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1, $bookcalcalendars);
print '</div>';
} else {
print '<div class="div-table-responsive-no-min borderbottom">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0);
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
print '</div>';
}
@ -1703,9 +1748,10 @@ $db->close();
* @param int $showinfo Add extended information (used by day and week view)
* @param int $minheight Minimum height for each event. 60px by default.
* @param string $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
* @param string $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
* @return void
*/
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0)
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array())
{
global $user, $conf, $langs;
global $action, $mode, $filter, $filtert, $status, $actioncode, $usergroup; // Filters used into search form
@ -1817,6 +1863,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$colorindex = 2;
$cssclass = 'family_birthday ';
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
} elseif ($event->type == 'bookcal_calendar') {
$numbirthday++;
$colorindex = 3;
$cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray[$fk_bookcal_availability]) ? $bookcalcalendarsarray[$fk_bookcal_availability][$event->fk_bookcal_availability] : "");
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
} else {
$numother++;
$color = ($event->icalcolor ? $event->icalcolor : -1);
@ -1904,6 +1955,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($event->type == 'holiday' && !GETPOST('check_holiday')) {
$morecss = 'hidden';
}
if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_availability])) {
$morecss = 'hidden';
}
if ($morecss != 'hidden') {
$itoshow++;
}
@ -1911,8 +1965,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$ireallyshown++;
}
//var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow);
print '<div id="event_'.$ymd.'_'.$i.'" class="event family_'.$event->type.' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
if (isModEnabled("bookcal") && $event->type == 'bookcal_calendar') {
print '<div id="event_'.$ymd.'_'.$i.'" class="event family_'.$event->type.'_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_availability].' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
} else {
print '<div id="event_'.$ymd.'_'.$i.'" class="event family_'.$event->type.' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
}
//print ' style="height: 100px;';
//print ' position: absolute; top: 40px; width: 50%;';
//print '"';

View file

@ -1979,7 +1979,7 @@ class Facture extends CommonInvoice
if (!empty($this->total_tva)) {
$datas['amountvat'] = '<br><b>'.$langs->trans('AmountVAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->revenuestamp)) {
if (!empty($this->revenuestamp) && $this->revenuestamp != 0) {
$datas['amountrevenustamp'] = '<br><b>'.$langs->trans('RevenueStamp').':</b> '.price($this->revenuestamp, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_localtax1) && $this->total_localtax1 != 0) {

View file

@ -87,6 +87,10 @@ class BonPrelevement extends CommonObject
*/
public $file;
/*
* @var string filename
*/
public $filename;
const STATUS_DRAFT = 0;
const STATUS_TRANSFERED = 1;

View file

@ -80,11 +80,11 @@ if ($action == 'verifyavailability') {
}
if (!$error) {
$datetocheckbooking_end = dol_time_plus_duree($datetocheckbooking, 1, 'd');
$sql = "SELECT b.start, b.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."bookcal_booking as b";
$sql = "SELECT b.datep, b.id";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as b";
$sql .= " WHERE fk_bookcal_availability = ".((int) $idavailability);
$sql .= " AND b.start >= '".$db->idate($datetocheckbooking)."'";
$sql .= " AND b.start < '".$db->idate($datetocheckbooking_end)."'";
$sql .= " AND b.datep >= '".$db->idate($datetocheckbooking)."'";
$sql .= " AND b.datep < '".$db->idate($datetocheckbooking_end)."'";
$resql = $db->query($sql);
if ($resql) {
@ -94,7 +94,7 @@ if ($action == 'verifyavailability') {
$response["content"] = array();
while ($i < $num) {
$obj = $db->fetch_object($resql);
$dateobject = $obj->start;
$dateobject = $obj->datep;
$dateobject = explode(" ", $dateobject)[1];
$dateobject = explode(":", $dateobject);

View file

@ -150,6 +150,8 @@ abstract class CommonDocGenerator
*/
public $result;
public $posxlabel;
public $posxup;
public $posxref;
public $posxpicture; // For picture
public $posxdesc; // For description

View file

@ -188,15 +188,13 @@ class FormContract
* @param int $showempty Show empty line
* @param int $showRef Show customer and supplier reference on each contract (when found)
* @param int $noouput 1=Return the output instead of display
* @return int Nbr of project if OK, <0 if KO
* @return string|void html string
*/
public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0)
{
global $langs;
$ret = '';
$ret .= '<form method="post" action="'.$page.'">';
$ret = '<form method="post" action="'.$page.'">';
$ret .= '<input type="hidden" name="action" value="setcontract">';
$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
$ret .= $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty, $showRef, 1);
@ -208,7 +206,5 @@ class FormContract
}
print $ret;
return $result;
}
}

View file

@ -145,13 +145,13 @@ class Notify
$nb = count($listofnotiftodo);
}
if ($nb < 0) {
$texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend");
$texte = img_object($langs->trans("Notifications"), 'email', 'class="pictofixedwidth"').$langs->trans("ErrorFailedToGetListOfNotificationsToSend");
} elseif ($nb == 0) {
$texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("NoNotificationsWillBeSent");
$texte = img_object($langs->trans("Notifications"), 'email', 'class="pictofixedwidth"').$langs->trans("NoNotificationsWillBeSent");
} elseif ($nb == 1) {
$texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ANotificationsWillBeSent");
$texte = img_object($langs->trans("Notifications"), 'email', 'class="pictofixedwidth"').$langs->trans("ANotificationsWillBeSent");
} elseif ($nb >= 2) {
$texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("SomeNotificationsWillBeSent", $nb);
$texte = img_object($langs->trans("Notifications"), 'email', 'class="pictofixedwidth"').$langs->trans("SomeNotificationsWillBeSent", $nb);
}
if (is_array($listofnotiftodo)) {

View file

@ -5532,7 +5532,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict
*/
function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', $sortorder = '', $morehtmlcenter = '', $num = -1, $totalnboflines = '', $picto = 'generic', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '', $limit = -1, $hideselectlimit = 0, $hidenavigation = 0, $pagenavastextinput = 0, $morehtmlrightbeforearrow = '')
{
global $conf, $langs;
global $conf;
$savlimit = $limit;
$savtotalnboflines = $totalnboflines;

View file

@ -371,7 +371,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
/*print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
print ", dbtablename=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
print ", perm: user->right->".$features.($feature2 ? "->".$feature2 : "")."=".($user->hasRight($features, $feature2, 'lire'))."<br>";
print ", perm: user->hasRight(".$features.($feature2 ? ",".$feature2 : "").", lire) = ".($feature2 ? $user->hasRight($features, $feature2, 'lire') : $user->hasRight($features, 'lire'))."<br>";
*/
$parentfortableentity = '';

View file

@ -163,12 +163,13 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
}*/
$content = dolStripPhpCode($content, $replacewith);
//var_dump($content);
// Protect the link styles.css.php to any replacement that we make after.
$content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content);
$content = str_replace('src="javascript.js.php', 'src="!~!~!~javascript.js.php', $content);
$content = str_replace('href="http', 'href="!~!~!~http', $content);
$content = str_replace('href="//', 'href="!~!~!~//', $content);
$content = str_replace('src="//', 'src="!~!~!~//', $content);
$content = str_replace('src="viewimage.php', 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="/viewimage.php', 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
@ -301,11 +302,14 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
}
} elseif (defined('USEDOLIBARRSERVER')) { // REPLACEMENT OF LINKS When page called from Dolibarr server
$content = str_replace('<link rel="stylesheet" href="/styles.css', '<link rel="stylesheet" href="styles.css', $content);
$content = str_replace(' async src="/javascript.js', ' async src="javascript.js', $content);
// Protect the link styles.css.php to any replacement that we make after.
$content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content);
$content = str_replace('src="javascript.css.php', 'src="!~!~!~javascript.css.php', $content);
$content = str_replace('href="http', 'href="!~!~!~http', $content);
$content = str_replace('href="//', 'href="!~!~!~//', $content);
$content = str_replace('src="//', 'src="!~!~!~//', $content);
$content = str_replace(array('src="viewimage.php', 'src="/viewimage.php'), 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
$content = str_replace(array('href="document.php', 'href="/document.php'), 'href="!~!~!~/document.php', $content);
@ -354,8 +358,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
if (empty($includehtmlcontentopened)) {
$content = str_replace('!~!~!~', '', $content);
}
} else // REPLACEMENT OF LINKS When page called from virtual host web server
{
} else { // REPLACEMENT OF LINKS When page called from virtual host web server
$symlinktomediaexists = 1;
if ($website->virtualhost) {
$content = preg_replace('/^(<link[^>]*rel="canonical" href=")\//m', '\1'.$website->virtualhost.'/', $content, -1, $nbrep);

View file

@ -248,7 +248,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
// Add js
$tplcontent .= '<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent .= '<!-- Include link to JS file -->'."\n";
$tplcontent .= '<script nonce="'.getNonce().'" async src="/javascript.js.php"></script>'."\n";
$tplcontent .= '<script nonce="'.getNonce().'" async src="/javascript.js.php?website=<?php echo $websitekey; ?>"></script>'."\n";
// Add headers
$tplcontent .= '<!-- Include HTML header from common file -->'."\n";
$tplcontent .= '<?php if (file_exists(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")) include DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html"; ?>'."\n";

View file

@ -297,7 +297,7 @@ class modBookCal extends DolibarrModules
$r = 0;
// Add here entries to declare new menus
/* BEGIN MODULEBUILDER TOPMENU */
$this->menu[$r++] = array(
/*$this->menu[$r++] = array(
'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top', // This is a Top menu entry
'titre'=>'ModuleBookCalName',
@ -311,18 +311,33 @@ class modBookCal extends DolibarrModules
'perms'=>'$user->rights->bookcal->availabilities->read', // Use 'perms'=>'$user->rights->bookcal->availabilities->read' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
);*/
/* END MODULEBUILDER TOPMENU */
/* BEGIN MODULEBUILDER LEFTMENU CALENDAR */
$this->menu[$r++] = array(
'fk_menu'=>'fk_mainmenu=agenda',
'type'=>'left',
'titre'=> 'MenuBookcalIndex',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em92"'),
'mainmenu'=>'agenda',
'leftmenu'=> 'bookcal',
'url'=> '/bookcal/bookcalindex.php',
'langs'=> 'bookcal',
'position'=> 1100+$r,
'enabled'=> '1',
'perms'=> '$user->rights->bookcal->calendar->read',
'user'=> 0
);
$this->menu[$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=bookcal',
'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal',
// This is a Left menu entry
'type'=>'left',
'titre'=>'List Calendar',
'mainmenu'=>'bookcal',
'leftmenu'=>'bookcal_calendar',
'titre'=>'Calendar',
'mainmenu'=>'agenda',
'leftmenu'=>'bookcal_calendar_list',
'url'=>'/bookcal/calendar_list.php',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'bookcal',
@ -337,12 +352,12 @@ class modBookCal extends DolibarrModules
);
$this->menu[$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=bookcal,fk_leftmenu=bookcal_calendar',
'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_calendar_list',
// This is a Left menu entry
'type'=>'left',
'titre'=>'New Calendar',
'mainmenu'=>'bookcal',
'leftmenu'=>'bookcal_calendar',
'titre'=>'NewCalendar',
'mainmenu'=>'agenda',
'leftmenu'=>'bookcal_new',
'url'=>'/bookcal/calendar_card.php?action=create',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'bookcal',
@ -405,11 +420,11 @@ class modBookCal extends DolibarrModules
$this->menu[$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=bookcal',
'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal',
// This is a Left menu entry
'type'=>'left',
'titre'=>'List Availabilities',
'mainmenu'=>'bookcal',
'titre'=>'Availabilities',
'mainmenu'=>'agenda',
'leftmenu'=>'bookcal_availabilities',
'url'=>'/bookcal/availabilities_list.php',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
@ -425,11 +440,11 @@ class modBookCal extends DolibarrModules
);
$this->menu[$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=bookcal,fk_leftmenu=bookcal_availabilities',
'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_availabilities',
// This is a Left menu entry
'type'=>'left',
'titre'=>'New Availabilities',
'mainmenu'=>'bookcal',
'titre'=>'NewAvailabilities',
'mainmenu'=>'agenda',
'leftmenu'=>'bookcal_availabilities',
'url'=>'/bookcal/availabilities_card.php?action=create',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.

View file

@ -871,7 +871,7 @@ if (empty($reshook)) {
* View
*/
$title = $langs->trans("Shipment");
$title = $object->ref.' - '.$langs->trans("Shipment");
if ($action == 'create2') {
$title = $langs->trans("CreateShipment");
}
@ -1379,7 +1379,7 @@ if ($action == 'create') {
//var_dump($dbatch);
$batchStock = + $dbatch->qty; // To get a numeric
$deliverableQty = min($quantityToBeDelivered, $batchStock);
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'>';
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? 'oddeven' : '').'>';
print '<td colspan="3" ></td><td class="center">';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>';
@ -1451,7 +1451,7 @@ if ($action == 'create') {
$deliverableQty = min($quantityToBeDelivered, $stock);
$deliverableQty = max(0, $deliverableQty);
// Quantity to send
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'>';
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? 'oddeven' : '').'>';
print '<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.') -->';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
@ -1591,7 +1591,7 @@ if ($action == 'create') {
}
$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'><td colspan="3"></td><td class="center">';
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ?'oddeven' : '').'><td colspan="3"></td><td class="center">';
print '<input class="qtyl '.$tooltipClass.'" title="'.$tooltipTitle.'" name="'.$inputName.'" id="'.$inputName.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>';
@ -1764,9 +1764,9 @@ if ($action == 'create') {
$text = $langs->trans("ConfirmValidateSending", $numref);
if (getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT')) {
$text .= '<br>'.$langs->trans("StockMovementWillBeRecorded").'.';
$text .= '<br>'.img_picto('', 'movement', 'class="pictofixedwidth"').$langs->trans("StockMovementWillBeRecorded").'.';
} elseif (getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) {
$text .= '<br>'.$langs->trans("StockMovementNotYetRecorded").'.';
$text .= '<br>'.img_picto('', 'movement', 'class="pictofixedwidth"').$langs->trans("StockMovementNotYetRecorded").'.';
}
if (isModEnabled('notification')) {

View file

@ -679,7 +679,7 @@ class Expedition extends CommonObject
return 1;
} else {
dol_syslog(get_class($this).'::Fetch no expedition found', LOG_ERR);
$this->error = 'Delivery with id '.$id.' not found';
$this->error = 'Shipment with id '.$id.' not found';
return 0;
}
} else {

View file

@ -40,15 +40,12 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array("sendings", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal'));
$langs->loadLangs(array("sendings", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal', 'receptions'));
if (isModEnabled('productbatch')) {
$langs->load('productbatch');
@ -80,7 +77,7 @@ $objectorder = new Commande($db);
if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
if ($result < 0) {
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$result = $object->fetch_thirdparty();
@ -105,6 +102,7 @@ if (!isModEnabled('stock')) {
$usercancreate = $user->hasRight('expedition', 'creer');
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php
/*
* Actions
*/
@ -319,7 +317,7 @@ $morejs = array('/expedition/js/lib_dispatch.js.php');
llxHeader('', $title, $help_url, '', 0, 0, $morejs);
if ($id > 0 || !empty($ref)) {
if ($object->id > 0 || !empty($object->ref)) {
$lines = $object->lines;
$num_prod = count($lines);

View file

@ -4107,8 +4107,6 @@ function migrate_delete_old_files($db, $langs, $conf)
'/core/modules/modCommercial.class.php',
'/core/modules/modProduit.class.php',
'/core/modules/modSkype.class.php',
'/phenix/inc/triggers/interface_modPhenix_Phenixsynchro.class.php',
'/webcalendar/inc/triggers/interface_modWebcalendar_webcalsynchro.class.php',
'/core/triggers/interface_modWebcalendar_Webcalsynchro.class.php',
'/core/triggers/interface_modCommande_Ecotax.class.php',
'/core/triggers/interface_modCommande_fraisport.class.php',
@ -4139,6 +4137,10 @@ function migrate_delete_old_files($db, $langs, $conf)
'/core/boxes/box_members.php',
'/includes/restler/framework/Luracast/Restler/Data/Object.php',
'/includes/restler/framework/Luracast/Restler/Data/Object.php',
'/phenix/inc/triggers/interface_modPhenix_Phenixsynchro.class.php',
'/webcalendar/inc/triggers/interface_modWebcalendar_webcalsynchro.class.php',
'/api/class/api_generic.class.php',
'/asterisk/cidlookup.php',
'/categories/class/api_category.class.php',

View file

@ -180,4 +180,5 @@ BrowserPush=Browser Popup Notification
Reminders=Reminders
ActiveByDefault=Enabled by default
Until=until
DataFromWasMerged=Data from %s was merged
DataFromWasMerged=Data from %s was merged
AgendaShowBookcalCalendar=Booking calendar: %s

View file

@ -1,5 +1,5 @@
# Dolibarr language file - Source file is en_US - companies
newSocieteAdded=Your contact has been recorded. We will go back to you soon...
newSocieteAdded=Your contact details have been recorded. We will get back to you soon...
ContactUsDesc=This form allows you to send us a message for a first contact.
ErrorCompanyNameAlreadyExists=Company name %s already exists. Choose another one.
ErrorSetACountryFirst=Set the country first

View file

@ -413,7 +413,9 @@ if (empty($reshook)) {
*/
$product_static = new Product($db);
$static_ws = new Workstation($db);
if (isModEnabled('workstation')) {
$workstation_static = new Workstation($db);
}
$product_fourn = new ProductFournisseur($db);
$title = $langs->trans("ProductsAndServices");
@ -1844,12 +1846,12 @@ while ($i < $imaxinloop) {
// Default Workstation
if (!empty($arrayfields['p.fk_default_workstation']['checked'])) {
print '<td align="left">';
if (!empty($obj->fk_default_workstation)) {
$static_ws->id = $obj->fk_default_workstation;
$static_ws->ref = $obj->ref_workstation;
$static_ws->status = $obj->status_workstation;
if (isModEnabled('workstation') && !empty($obj->fk_default_workstation)) {
$workstation_static->id = $obj->fk_default_workstation;
$workstation_static->ref = $obj->ref_workstation;
$workstation_static->status = $obj->status_workstation;
print $static_ws->getNomUrl(1);
print $workstation_static->getNomUrl(1);
}
print '</td>';
if (!$i) {

View file

@ -44,6 +44,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$langs->loadLangs(array("main", "other", "dict", "agenda", "errors", "companies"));
@ -169,13 +171,21 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $
if ($action == 'add') {
$error = 0;
$urlback = '';
$idcontact = 0;
$calendar = new Calendar($db);
$contact = new Contact($db);
$actioncomm = new ActionComm($db);
$res = $calendar->fetch($fk_calendar);
if ($res < 0) {
$error++;
$errmsg .= $calendar->error." ".join(',', $calendar->errors);
}
if (!is_object($user)) {
$user = new User($db);
}
$booking = new ActionComm($db);
$db->begin();
if (!GETPOST("lastname")) {
$error++;
@ -191,21 +201,71 @@ if ($action == 'add') {
}
if (!$error) {
$booking->ref = $booking->getNextNumRef();
$booking->lastname = GETPOST("lastname");
$booking->firstname = GETPOST("firstname");
$booking->email = GETPOST("email");
$booking->description = GETPOST("description");
$booking->duration = GETPOST("duration");
$booking->start = GETPOST("datetimebooking", 'int');
$booking->fk_bookcal_availability = GETPOST("id", 'int');
$sql = "SELECT s.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as s";
$sql .= " WHERE s.lastname = '".GETPOST("lastname")."'";
$sql .= " AND s.firstname = '".GETPOST("firstname")."'";
$sql .= " AND s.email = '".GETPOST("email")."'";
$resql = $db->query($sql);
$result = $booking->create($user);
if ($result <= 0) {
if ($resql) {
$num = $db->num_rows($resql);
if ($num > 0) {
$obj = $db->fetch_object($resql);
$idcontact = $obj->rowid;
$contact->fetch($idcontact);
} else {
$contact->lastname = GETPOST("lastname");
$contact->firstname = GETPOST("firstname");
$contact->email = GETPOST("email");
$result = $contact->create($user);
if ($result < 0) {
$error++;
$errmsg .= $contact->error." ".join(',', $contact->errors);
}
}
} else {
$error++;
$errmsg = ($booking->error ? $booking->error.'<br>' : '').join('<br>', $booking->errors);
$errmsg .= $db->lasterror();
}
}
if (!$error) {
$dateend = dol_time_plus_duree(GETPOST("datetimebooking", 'int'), GETPOST("duration"), 'i');
$actioncomm->label = "test";
$actioncomm->type = 'AC_RDV';
$actioncomm->type_id = 5;
$actioncomm->datep = GETPOST("datetimebooking", 'int');
$actioncomm->datef = $dateend;
$actioncomm->note_private = GETPOST("description");
$actioncomm->percentage = -1;
$actioncomm->fk_bookcal_availability = GETPOST("id", 'int');
$actioncomm->userownerid = $calendar->visibility;
$actioncomm->contact_id = $contact->id;
$actioncomm->socpeopleassigned = $contact->id;
$result = $actioncomm->create($user);
if ($result < 0) {
$error++;
$errmsg .= $actioncomm->error." ".join(',', $actioncomm->errors);
}
if (!$error) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources";
$sql .= "(fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
$sql .= ") VALUES (";
$sql .= (int) $actioncomm->id;
$sql .= ", 'socpeople'";
$sql .= ", ". (int) $contact->id;
$sql .= ", 0, 0, 0)";
$resql = $db->query($sql);
if (!$resql) {
$error++;
$errmsg .= $db->lasterror();
}
}
}
if (!$error) {
$db->commit();
$action = 'afteradd';

View file

@ -180,7 +180,7 @@ print '<div class="bookcalpublicarea centpercent" style="position:absolute;top:5
print '<div class="bookcalform center" style="width:70%;padding:5px;max-height:360px">';
print '<h2>'.(!empty($object->label) ? $object->label : $object->ref).'</h2>';
$sql = "SELECT b.rowid, b.ref, b.label, b.start, b.end, b.duration, b.startHour, b.endHour";
$sql = "SELECT b.rowid, b.label, b.start, b.end, b.duration, b.startHour, b.endHour";
$sql .= " FROM ".MAIN_DB_PREFIX."bookcal_availabilities as b";
$sql .= " WHERE b.status = ".(int) $availabilities::STATUS_VALIDATED;
$sql .= " AND b.fk_bookcal_calendar = ".(int) $id;
@ -193,7 +193,7 @@ if ($resql) {
while ($i < $num) {
$i++;
$obj = $db->fetch_object($resql);
print '<a href="'.DOL_URL_ROOT.'/public/bookcal/booking.php?id='.$obj->rowid.'&fk_calendar='.$id.'"><button type="button">'.(!empty($obj->label) ? $obj->label : $obj->ref).'</button>';
print '<a href="'.DOL_URL_ROOT.'/public/bookcal/booking.php?id='.$obj->rowid.'&fk_calendar='.$id.'"><button type="button">'.(!empty($obj->label) ? $obj->label : $obj->id).'</button>';
}
}
print '</div>';

View file

@ -0,0 +1,171 @@
<?php
/* Copyright (C) 2016-2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/public/website/javascript.js.php
* \ingroup website
* \brief Page to output style page. Called with <script async src="/javascript.js.php?websiteid=123"></script>
*/
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1); // Disables token renewal
}
if (!defined('NOLOGIN')) {
define("NOLOGIN", 1);
}
if (!defined('NOCSRFCHECK')) {
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOIPCHECK')) {
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
/**
* Header empty
*
* @return void
*/
function llxHeader()
{
}
/**
* Footer empty
*
* @return void
*/
function llxFooter()
{
}
require '../../master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error = 0;
$website = GETPOST('website', 'alpha');
$websiteid = GETPOST('websiteid', 'int');
$pageid = GETPOST('page', 'alpha') ?GETPOST('page', 'alpha') : GETPOST('pageid', 'alpha');
$accessallowed = 1;
$type = '';
/*
* View
*/
$appli = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli = $conf->global->MAIN_APPLICATION_TITLE;
}
//print 'Directory with '.$appli.' websites.<br>';
if (empty($pageid)) {
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
$object = new Website($db);
if ($websiteid) {
$object->fetch($websiteid);
$website = $object->ref;
} else {
$object->fetch(0, $website);
}
$objectpage = new WebsitePage($db);
/* Not required for CSS file
$array=$objectpage->fetchAll($object->id);
if (is_array($array) && count($array) > 0)
{
$firstrep=reset($array);
$pageid=$firstrep->id;
}
*/
}
/* Not required for CSS file
if (empty($pageid))
{
$langs->load("website");
print $langs->trans("PreviewOfSiteNotYetAvailable");
exit;
}
*/
// Security: Delete string ../ into $original_file
global $dolibarr_main_data_root;
$original_file = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$website.'/javascript.js.php';
// Find the subdirectory name as the reference
$refname = basename(dirname($original_file)."/");
// Security:
// Limite acces si droits non corrects
if (!$accessallowed) {
accessforbidden();
}
// Security:
// On interdit les remontees de repertoire ainsi que les pipe dans
// les noms de fichiers.
if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
dol_syslog("Refused to deliver file ".$original_file);
$file = basename($original_file); // Do no show plain path of original_file in shown error message
dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file));
exit;
}
clearstatcache();
$filename = basename($original_file);
// Output file on browser
dol_syslog("javascript.js.css.php include $original_file $filename content-type=$type");
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
// This test if file exists should be useless. We keep it to find bug more easily
if (!file_exists($original_file_osencoded)) {
$langs->load("website");
print $langs->trans("RequestedPageHasNoContentYet", $pageid);
//dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
exit;
}
// Output page content
define('USEDOLIBARRSERVER', 1);
print '/* Page content '.$original_file.' : JS content that was saved into tpl dir */'."\n";
require_once $original_file_osencoded;
if (is_object($db)) {
$db->close();
}

View file

@ -1037,14 +1037,16 @@ if ($action == 'create') {
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#autofill").click(function() {';
jQuery("#autofill").click(function(event) {
event.preventDefault();';
$i = 1;
while ($i <= $numAsked) {
print 'jQuery("#qtyl'.$i.'").val(jQuery("#qtyasked'.$i.'").val() - jQuery("#qtydelivered'.$i.'").val());'."\n";
$i++;
}
print '});
jQuery("#autoreset").click(function() {';
jQuery("#autoreset").click(function(event) {
event.preventDefault();';
$i = 1;
while ($i <= $numAsked) {
print 'jQuery("#qtyl'.$i.'").val(0);'."\n";
@ -1072,8 +1074,8 @@ if ($action == 'create') {
print '<td>'.$langs->trans("BuyingPrice").'</td>';
}
if (isModEnabled('productbatch')) {
print ' <br>(<a href="#" id="autofill">'.$langs->trans("Fill").'</a>';
print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)';
print ' <br><center><a href="#" id="autofill"><span class="fas fa-fill pictofixedwidth" style=""></span> '.$langs->trans("Fill").'</a>';
print ' &nbsp; &nbsp; <a href="#" id="autoreset"><span class="fas fa-eraser pictofixedwidth" style=""></span>'.$langs->trans("Reset").'</a></center><br>';
}
print '</td>';
if (isModEnabled('stock')) {
@ -1370,6 +1372,11 @@ if ($action == 'create') {
}
$text = $langs->trans("ConfirmValidateReception", $numref);
if (getDolGlobalString('STOCK_CALCULATE_ON_RECEPTION')) {
$text .= '<br>'.img_picto('', 'movement', 'class="pictofixedwidth"').$langs->trans("StockMovementWillBeRecorded").'.';
} elseif (getDolGlobalString('STOCK_CALCULATE_ON_RECEPTION_CLOSE')) {
$text .= '<br>'.img_picto('', 'movement', 'class="pictofixedwidth"').$langs->trans("StockMovementNotYetRecorded").'.';
}
if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
@ -1378,7 +1385,7 @@ if ($action == 'create') {
$text .= $notify->confirmMessage('RECEPTION_VALIDATE', $object->socid, $object);
}
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateReception'), $text, 'confirm_valid', '', 0, 1);
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateReception'), $text, 'confirm_valid', '', 0, 1, 250);
}
// Confirm cancelation

View file

@ -473,7 +473,7 @@ class Reception extends CommonObject
return 1;
} else {
dol_syslog(get_class($this).'::Fetch no reception found', LOG_ERR);
$this->error = 'Delivery with id '.$id.' not found';
$this->error = 'Reception with id '.$id.' not found';
return 0;
}
} else {

View file

@ -398,19 +398,20 @@ class Website extends CommonObject
/**
* Load all object in memory ($this->records) from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
*
* @return int <0 if KO, >0 if OK
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @return array|int int <0 if KO, array of pages if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
dol_syslog(__METHOD__, LOG_DEBUG);
$records = array();
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.entity,";
@ -444,35 +445,34 @@ class Website extends CommonObject
if (!empty($limit)) {
$sql .= $this->db->plimit($limit, $offset);
}
$this->lines = array();
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) {
$line = new self($this->db);
$record = new self($this->db);
$line->id = $obj->rowid;
$record->id = $obj->rowid;
$line->entity = $obj->entity;
$line->ref = $obj->ref;
$line->description = $obj->description;
$line->lang = $obj->lang;
$line->otherlang = $obj->otherlang;
$line->status = $obj->status;
$line->fk_default_home = $obj->fk_default_home;
$line->virtualhost = $obj->virtualhost;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_modification = $this->db->jdate($obj->date_modification);
$record->entity = $obj->entity;
$record->ref = $obj->ref;
$record->description = $obj->description;
$record->lang = $obj->lang;
$record->otherlang = $obj->otherlang;
$record->status = $obj->status;
$record->fk_default_home = $obj->fk_default_home;
$record->virtualhost = $obj->virtualhost;
$record->fk_user_creat = $obj->fk_user_creat;
$record->fk_user_modif = $obj->fk_user_modif;
$record->date_creation = $this->db->jdate($obj->date_creation);
$record->date_modification = $this->db->jdate($obj->date_modification);
$this->lines[$line->id] = $line;
$records[$record->id] = $record;
}
$this->db->free($resql);
return $num;
return $records;
} else {
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);

View file

@ -157,11 +157,11 @@ if (empty($action)) {
$object = new Website($db);
$objectpage = new WebsitePage($db);
$object->fetchAll('ASC', 'position'); // Init $object->lines with list of websites
$listofwebsites = $object->fetchAll('ASC', 'position'); // Init list of websites
// If website not defined, we take first found
if (!($websiteid > 0) && empty($websitekey) && $action != 'createsite') {
foreach ($object->lines as $key => $valwebsite) {
foreach ($listofwebsites as $key => $valwebsite) {
$websitekey = $valwebsite->ref;
break;
}
@ -2873,13 +2873,13 @@ if (!GETPOST('hide_websitemenu')) {
$out = '';
$out .= '<select name="website" class="minwidth100 width200 maxwidth150onsmartphone" id="website">';
if (empty($object->lines)) {
if (empty($listofwebsites)) {
$out .= '<option value="-1">&nbsp;</option>';
}
// Loop on each sites
$i = 0;
foreach ($object->lines as $key => $valwebsite) {
foreach ($listofwebsites as $key => $valwebsite) {
if (empty($websitekey)) {
if ($action != 'createsite') {
$websitekey = $valwebsite->ref;