Merge branch 'develop' into patch-11
This commit is contained in:
commit
052ff2cc69
5 changed files with 66 additions and 38 deletions
|
|
@ -126,6 +126,25 @@ if ($action == 'update' && !GETPOST('cancel')) {
|
|||
$action = 'edit';
|
||||
}
|
||||
|
||||
if ($action == 'confirm_deleteproperty') {
|
||||
$key = GETPOST('key', 'alpha');
|
||||
|
||||
//var_dump($currentConfigurations[$key]);exit;
|
||||
if (isset($currentConfigurations[$key])) {
|
||||
unset($currentConfigurations[$key]);
|
||||
|
||||
$newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE);
|
||||
$res = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity);
|
||||
if ($res) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']);
|
||||
setEventMessages($langs->trans("SetupDeleted"), null, 'mesgs');
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorDeleting"), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -152,11 +171,25 @@ $newbutton = '';
|
|||
|
||||
print load_fiche_titre($langs->trans("AIPromptForFeatures"), $newbutton, '');
|
||||
|
||||
if ($action == 'deleteproperty') {
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"].'?key='.urlencode(GETPOST('key', 'alpha')),
|
||||
$langs->trans('Delete'),
|
||||
$langs->trans('ConfirmDeleteSetup', GETPOST('key', 'alpha')),
|
||||
'confirm_deleteproperty',
|
||||
'',
|
||||
0,
|
||||
1
|
||||
);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
$out .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$out .= '<input type="hidden" name="action" value="update">';
|
||||
|
||||
|
||||
$out .= '<table class="noborder centpercent">';
|
||||
$out .= '<thead>';
|
||||
$out .= '<tr class="liste_titre">';
|
||||
|
|
@ -235,7 +268,10 @@ if ($action == 'edit' || $action == 'create') {
|
|||
|
||||
$out .= '<thead>';
|
||||
$out .= '<tr class="liste_titre">';
|
||||
$out .= '<td>'.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']).'</td>';
|
||||
$out .= '<td>'.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']);
|
||||
$out .= '<a class="editfielda reposition marginleftonly marginrighttonly " href="'.$_SERVER["PHP_SELF"].'?action=editproperty&token='.newToken().'&key='.urlencode($key).'">'.img_edit().'</a>';
|
||||
$out .= '<a class="deletefielda marginleftonly right" href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&token='.newToken().'&key='.urlencode($key).'">'.img_delete().'</a>';
|
||||
$out .= '</td>';
|
||||
$out .= '<td></td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '</thead>';
|
||||
|
|
|
|||
|
|
@ -109,10 +109,10 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
|||
* Return an example of result returned by getNextValue
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @param Product $objproduct Object product
|
||||
* @param ?Product $objproduct Object product
|
||||
* @return string Return string example
|
||||
*/
|
||||
public function getExample($langs, $objproduct = 0)
|
||||
public function getExample($langs, $objproduct = null)
|
||||
{
|
||||
$examplebarcode = $this->getNextValue($objproduct, '');
|
||||
if (!$examplebarcode) {
|
||||
|
|
@ -155,18 +155,19 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
|||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param CommonObject $objproduct Object product
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @return string Value if OK, '' if module not configured, <0 if KO
|
||||
* @param ?CommonObject $objproduct Object product (not used)
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @return string Value if OK, '' if module not configured, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objproduct, $type = '')
|
||||
public function getNextValue($objproduct = null, $type = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
global $db;
|
||||
|
||||
if (!$objproduct instanceof Product) {
|
||||
if (is_object($objproduct) && !$objproduct instanceof Product) {
|
||||
dol_syslog(get_class($this)."::getNextValue used on incompatible".get_class($objproduct), LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -178,13 +179,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
|||
$type = getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE');
|
||||
} //get barcode type configuration for products if $type not set
|
||||
|
||||
// TODO
|
||||
|
||||
// Get Mask value
|
||||
$mask = '';
|
||||
if (getDolGlobalString('BARCODE_STANDARD_PRODUCT_MASK')) {
|
||||
$mask = getDolGlobalString('BARCODE_STANDARD_PRODUCT_MASK');
|
||||
}
|
||||
$mask = getDolGlobalString('BARCODE_STANDARD_PRODUCT_MASK');
|
||||
|
||||
if (empty($mask)) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
|
@ -216,7 +212,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
|||
}
|
||||
}
|
||||
//End barcode with key
|
||||
return $numFinal;
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -72,10 +72,11 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
|||
}
|
||||
|
||||
|
||||
/** Return description of module
|
||||
/**
|
||||
* Return description of module
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
*/
|
||||
public function info($langs)
|
||||
{
|
||||
|
|
@ -120,10 +121,10 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
|||
* Return an example of result returned by getNextValue
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @param Societe $objthirdparty Object third-party
|
||||
* @param ?Societe $objthirdparty Object third-party
|
||||
* @return string Return string example
|
||||
*/
|
||||
public function getExample($langs, $objthirdparty = 0)
|
||||
public function getExample($langs, $objthirdparty = null)
|
||||
{
|
||||
$examplebarcode = $this->getNextValue($objthirdparty, '');
|
||||
if (!$examplebarcode) {
|
||||
|
|
@ -169,13 +170,13 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
|||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param CommonObject $objthirdparty Object third-party
|
||||
* @param ?CommonObject $objthirdparty Object third-party
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @return string Value if OK, '' if module not configured, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objthirdparty, $type = '')
|
||||
public function getNextValue($objthirdparty = null, $type = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
global $db;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean)
|
||||
|
|
@ -184,13 +185,8 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
|||
$type = getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY');
|
||||
} //get barcode type configuration for companies if $type not set
|
||||
|
||||
// TODO
|
||||
|
||||
// Get Mask value
|
||||
$mask = '';
|
||||
if (getDolGlobalString('BARCODE_STANDARD_THIRDPARTY_MASK')) {
|
||||
$mask = getDolGlobalString('BARCODE_STANDARD_THIRDPARTY_MASK');
|
||||
}
|
||||
$mask = getDolGlobalString('BARCODE_STANDARD_THIRDPARTY_MASK');
|
||||
|
||||
if (empty($mask)) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
|
@ -222,6 +218,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
|||
}
|
||||
}
|
||||
//End barcode with key
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
|
|
@ -242,10 +239,6 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
|||
*/
|
||||
public function verif($db, &$code, $thirdparty, $thirdparty_type, $type)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//var_dump($code.' '.$thirdparty->ref.' '.$thirdparty_type);exit;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$result = 0;
|
||||
|
|
@ -273,6 +266,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
|
|||
}
|
||||
|
||||
dol_syslog(get_class($this)."::verif type=".$thirdparty_type." result=".$result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
|
|||
/**
|
||||
* Return next value available
|
||||
*
|
||||
* @param CommonObject $objcommon Object Product, Thirdparty
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @return string Value
|
||||
* @param ?CommonObject $objcommon Object Product, Thirdparty
|
||||
* @param string $type Type of barcode (EAN, ISBN, ...)
|
||||
* @return string Value
|
||||
*/
|
||||
public function getNextValue($objcommon, $type = '')
|
||||
public function getNextValue($objcommon = null, $type = '')
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("Function_getNextValue_InModuleNotWorking");
|
||||
|
|
|
|||
|
|
@ -2425,6 +2425,7 @@ LargeModern=Large - Modern
|
|||
SpecialCharActivation=Enable the button to open a virtual keyboard to enter special characters
|
||||
DeleteExtrafield=Delete extrafield
|
||||
ConfirmDeleteExtrafield=Do you confirm deletion of the field %s ? All data saved into this field will be definitely deleted
|
||||
ConfirmDeleteSetup=Are you sure you want to delete the setup for %s ?
|
||||
ExtraFieldsSupplierInvoicesRec=Complementary attributes (templates invoices)
|
||||
ExtraFieldsSupplierInvoicesLinesRec=Complementary attributes (template invoice lines)
|
||||
ParametersForTestEnvironment=Parameters for test environment
|
||||
|
|
|
|||
Loading…
Reference in a new issue