Merge remote-tracking branch 'upstream/develop' into socialnetworks

This commit is contained in:
Frédéric FRANCE 2019-10-07 07:57:05 +02:00
commit f80fa08a2d
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
7 changed files with 69 additions and 29 deletions

View File

@ -36,6 +36,7 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$massaction = GETPOST('massaction', 'aZ09');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'accountingaccountlist'; // To manage different context of search $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'accountingaccountlist'; // To manage different context of search
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
@ -100,7 +101,7 @@ if (empty($reshook))
$search_array_options=array(); $search_array_options=array();
} }
if (GETPOST('change_chart', 'alpha')) if (GETPOST('change_chart', 'alpha') && (GETPOST('valid_change_chart', 'int') || empty($conf->use_javascript_ajax)))
{ {
$chartofaccounts = GETPOST('chartofaccounts', 'int'); $chartofaccounts = GETPOST('chartofaccounts', 'int');
@ -236,6 +237,24 @@ if ($resql)
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype); if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
if (! empty($conf->use_javascript_ajax))
{
print '<!-- Add javascript to update a flag when we select "Change plan" -->
<script type="text/javascript">
$(document).ready(function () {
$("#searchFormList").on("submit", function (e) {
console.log("chartofaccounts focus = "+$("#chartofaccounts").is(":focus"));
console.log("change_chart focus = "+$("#change_chart").is(":focus"));
if ($("#change_chart").is(":focus"))
{
console.log("We set valid_change_chart to 1");
$("#valid_change_chart").val(1);
}
return true;
});
});
</script>';
}
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -278,7 +297,8 @@ if ($resql)
else dol_print_error($db); else dol_print_error($db);
print "</select>"; print "</select>";
print ajax_combobox("chartofaccounts"); print ajax_combobox("chartofaccounts");
print '<input type="submit" class="button" name="change_chart" tabindex="-1" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">'; print '<input type="submit" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<input type="hidden" name="valid_change_chart" id="valid_change_chart" value="0">';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
@ -286,6 +306,9 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$moreforfilter = '';
$massactionbutton = '';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";

View File

@ -909,7 +909,7 @@ if ($resql)
} }
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td class="liste_titre maxwidthsearch">'; print '<td class="liste_titre right">';
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1); print $form->textwithpicto('', $htmltext, 1);
print '</td>'; print '</td>';

View File

@ -7450,11 +7450,7 @@ class Form
*/ */
public function showFilterButtons() public function showFilterButtons()
{ {
global $conf, $langs;
$out='<div class="nowrap">'; $out='<div class="nowrap">';
//$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
//$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
$out.='<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>'; $out.='<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
$out.='<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>'; $out.='<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
$out.='</div>'; $out.='</div>';

View File

@ -466,8 +466,8 @@ print '<script type="text/javascript" language="javascript">
if($value == 'radio')$value = 'select'; if($value == 'radio')$value = 'select';
} }
foreach ($extrafields-> as $key => $val) { foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val)
{
print '<tr><td>' . $extrafields->attributes[$elementtype]['label'][$key]; print '<tr><td>' . $extrafields->attributes[$elementtype]['label'][$key];
if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');

View File

@ -93,7 +93,6 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
$extrafields->fetch_name_optionals_label($object->table_element_line); $extrafields->fetch_name_optionals_label($object->table_element_line);
// Load object. Make an object->fetch // Load object. Make an object->fetch
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
@ -1032,8 +1031,7 @@ if ($action == 'create')
if (empty($reshook)) { if (empty($reshook)) {
// copy from order // copy from order
$orderExtrafields = new Extrafields($db); $extrafields->fetch_name_optionals_label($object->table_element);
$orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element);
if ($object->fetch_optionals() > 0) { if ($object->fetch_optionals() > 0) {
$expe->array_options = array_merge($expe->array_options, $object->array_options); $expe->array_options = array_merge($expe->array_options, $object->array_options);
} }
@ -1575,14 +1573,18 @@ if ($action == 'create')
// Line extrafield // Line extrafield
if (! empty($extrafields)) if (! empty($extrafields))
{ {
//var_dump($line);
$colspan=5; $colspan=5;
$extrafields->fetch_name_optionals_label($object->table_element_line); $extrafields->fetch_name_optionals_label($expe->table_element_line);
$expLine = new ExpeditionLigne($db);
$srcLine = new OrderLine($db); $srcLine = new OrderLine($db);
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline $srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
//$line->fetch_optionals($line->id); //$line->fetch_optionals($line->id);
$line->array_options = array_merge($line->array_options, $srcLine->array_options); $line->array_options = array_merge($line->array_options, $srcLine->array_options);
print $line->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"','colspan'=>$colspan), $indiceAsked, '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
} }
@ -1839,8 +1841,8 @@ elseif ($id || $ref)
print '<input name="action" value="settrueWeight" type="hidden">'; print '<input name="action" value="settrueWeight" type="hidden">';
print '<input name="id" value="'.$object->id.'" type="hidden">'; print '<input name="id" value="'.$object->id.'" type="hidden">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.'" type="text">'; print '<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.'" type="text" class="width50">';
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units); print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">'; print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">'; print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
print '</form>'; print '</form>';
@ -1848,7 +1850,7 @@ elseif ($id || $ref)
else else
{ {
print $object->trueWeight; print $object->trueWeight;
print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string($object->weight_units, "weight"):''; print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string(0, "weight", $object->weight_units):'';
} }
// Calculated // Calculated
@ -1865,7 +1867,7 @@ elseif ($id || $ref)
// Width // Width
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer); print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string($object->width_units, "size"):''; print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string(0, "size", $object->width_units):'';
print '</td></tr>'; print '</td></tr>';
// Height // Height
@ -1876,8 +1878,8 @@ elseif ($id || $ref)
print '<input name="action" value="settrueHeight" type="hidden">'; print '<input name="action" value="settrueHeight" type="hidden">';
print '<input name="id" value="'.$object->id.'" type="hidden">'; print '<input name="id" value="'.$object->id.'" type="hidden">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.'" type="text">'; print '<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.'" type="text" class="width50">';
print $formproduct->selectMeasuringUnits("size_units", "size", $object->size_units); print $formproduct->selectMeasuringUnits("size_units", "size", $object->size_units, 0, 2);
print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">'; print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">';
print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">'; print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">';
print '</form>'; print '</form>';
@ -1885,7 +1887,7 @@ elseif ($id || $ref)
else else
{ {
print $object->trueHeight; print $object->trueHeight;
print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string($object->height_units, "size"):''; print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string(0, "size", $object->height_units):'';
} }
print '</td></tr>'; print '</td></tr>';
@ -1893,7 +1895,7 @@ elseif ($id || $ref)
// Depth // Depth
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer); print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string($object->depth_units, "size"):''; print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string(0, "size", $object->depth_units):'';
print '</td></tr>'; print '</td></tr>';
// Volume // Volume
@ -2100,7 +2102,6 @@ elseif ($id || $ref)
} }
print "</tr>\n"; print "</tr>\n";
print '</thead>'; print '</thead>';
$var=false;
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
@ -2257,8 +2258,8 @@ elseif ($id || $ref)
} }
} }
} }
}
print '</td>'; print '</td>';
}
if ($action == 'editline' && $lines[$i]->id == $line_id) if ($action == 'editline' && $lines[$i]->id == $line_id)
{ {
@ -2408,13 +2409,13 @@ elseif ($id || $ref)
// Weight // Weight
print '<td class="center linecolweight">'; print '<td class="center linecolweight">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units, "weight"); if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "weight", $lines[$i]->weight_units);
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
// Volume // Volume
print '<td class="center linecolvolume">'; print '<td class="center linecolvolume">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume"); if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "volume", $lines[$i]->volume_units);
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
@ -2426,8 +2427,9 @@ elseif ($id || $ref)
print '<td class="center" colspan="2" valign="middle">'; print '<td class="center" colspan="2" valign="middle">';
print '<input type="submit" class="button" id="savelinebutton" name="save" value="' . $langs->trans("Save") . '"><br>'; print '<input type="submit" class="button" id="savelinebutton" name="save" value="' . $langs->trans("Save") . '"><br>';
print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="' . $langs->trans("Cancel") . '"><br>'; print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="' . $langs->trans("Cancel") . '"><br>';
print '</td>';
} }
elseif ($object->statut == 0) elseif ($object->statut == Expedition::STATUS_DRAFT)
{ {
// edit-delete buttons // edit-delete buttons
print '<td class="linecoledit center">'; print '<td class="linecoledit center">';
@ -2449,7 +2451,10 @@ elseif ($id || $ref)
// Display lines extrafields // Display lines extrafields
if (! empty($extrafields)) { if (! empty($extrafields)) {
$colspan= empty($conf->productbatch->enabled) ? 5 : 6; $colspan=6;
if ($origin && $origin_id > 0) $colspan++;
if (! empty($conf->productbatch->enabled)) $colspan++;
if (! empty($conf->stock->enabled)) $colspan++;
$lines[$i]->fetch_optionals($lines[$i]->id); $lines[$i]->fetch_optionals($lines[$i]->id);

View File

@ -537,6 +537,9 @@ if ($id > 0 || ! empty($ref))
print '</td></tr>'; print '</td></tr>';
} }
$expe = new Expedition($db);
$extrafields->fetch_name_optionals_label($expe->table_element);
// Other attributes // Other attributes
$cols = 2; $cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';

View File

@ -33,6 +33,19 @@ ALTER TABLE llx_account_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL
ALTER TABLE llx_expensereport ADD COLUMN paid smallint default 0 NOT NULL; ALTER TABLE llx_expensereport ADD COLUMN paid smallint default 0 NOT NULL;
UPDATE llx_expensereport set paid = 1 WHERE fk_statut = 6 and paid = 0; UPDATE llx_expensereport set paid = 1 WHERE fk_statut = 6 and paid = 0;
UPDATE llx_c_units SET short_label = 'i' WHERE code = 'MI';
UPDATE llx_c_units SET unit_type = 'weight', short_label = 'kg', scale = 0 WHERE code = 'KG';
UPDATE llx_c_units SET unit_type = 'weight', short_label = 'g', scale = -3 WHERE code = 'G';
UPDATE llx_c_units SET unit_type = 'time' WHERE code IN ('S','H','D');
UPDATE llx_c_units SET unit_type = 'size' WHERE code IN ('M','LM');
UPDATE llx_c_units SET label = 'SizeUnitm', scale = 0 WHERE code IN ('M');
UPDATE llx_c_units SET active = 0, scale = 0 WHERE code IN ('LM');
UPDATE llx_c_units SET unit_type = 'surface', scale = 0 WHERE code IN ('M2');
UPDATE llx_c_units SET unit_type = 'volume', scale = 0 WHERE code IN ('M3','L');
UPDATE llx_c_units SET scale = -3, active = 0 WHERE code IN ('L');
UPDATE llx_c_units SET label = 'VolumeUnitm3' WHERE code IN ('M3');
UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
-- For v11 -- For v11