add field in create product

This commit is contained in:
jpb 2021-07-20 22:39:30 +02:00
parent 875167d593
commit d61b831737
3 changed files with 12 additions and 4 deletions

View File

@ -716,8 +716,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
// service and we setted mandatory_period to true
if (data.mandatory_period == 1 && data.type == 1 ) {
console.log("we are good to color date input");
jQuery("#date_start").addClass("error");
jQuery("#date_end").addClass("error");
}else{

View File

@ -341,7 +341,7 @@ $coldisplay++;
$res = $line->fetch_product();
if ($res > 0 ) {
if ($line->product->isMandatoryPeriod() && $line->product->isService()) {
if ( $line->product->isMandatoryPeriod() && $line->product->isService()) {
print 'jQuery("#date_start").addClass("error");';
}
}

View File

@ -106,6 +106,7 @@ $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha');
$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha');
$checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha');
// by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html
$label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml';
@ -264,7 +265,7 @@ if (empty($reshook)) {
$object->ref = $ref;
$object->label = GETPOST('label', $label_security_check);
$object->price_base_type = GETPOST('price_base_type', 'aZ09');
$object->mandatory_period = !empty(GETPOST("mandatoryperiod",'alpha')) ? 1 : 0;
if ($object->price_base_type == 'TTC') {
$object->price_ttc = GETPOST('price');
} else {
@ -1401,6 +1402,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1);
print '</td></tr>';
if (!empty($conf->service->enabled)){
if ($object->isService()){
// Mandatory period
print '<tr><td class="titlefieldcreate">'.$langs->trans("mandatoryperiod").'</td>';
print '<td><input type="checkbox" name="mandatoryperiod" /> ';
print '</td></tr>';
}
}
print '</table>';
print '<br>';