Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-07-19 19:14:58 +02:00
commit dbdf0edfc3
8 changed files with 103 additions and 40 deletions

View File

@ -63,6 +63,7 @@ $search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$search_morphy = GETPOST("search_morphy", 'alpha');
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
@ -382,6 +383,9 @@ if ($search_status != '') {
// Peut valoir un nombre ou liste de nombre separes par virgules
$sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
}
if ($search_morphy != '') {
$sql .= natural_search("d.morphy", $search_morphy);
}
if ($search_ref) {
$sql .= natural_search("d.ref", $search_ref);
}
@ -731,6 +735,11 @@ if (!empty($arrayfields['d.login']['checked'])) {
}
if (!empty($arrayfields['d.morphy']['checked'])) {
print '<td class="liste_titre left">';
$arraymorphy = array('mor'=>$langs->trans("Moral"), 'phy'=>$langs->trans("Physical"));
print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1);
print '</td>';
}
if (!empty($arrayfields['t.libelle']['checked'])) {
print '</td>';
}
if (!empty($arrayfields['t.libelle']['checked'])) {

View File

@ -7633,16 +7633,24 @@ abstract class CommonObject
}
if ($result > 0) {
if ($object->element === 'product') {
$getnomurlparam3 = (!isset($InfoFieldList[5]) ? 0 : $InfoFieldList[5]);
$getnomurlparam4 = (!isset($InfoFieldList[6]) ? -1 : $InfoFieldList[6]);
$getnomurlparam5 = (!isset($InfoFieldList[7]) ? 0 : $InfoFieldList[7]);
$getnomurlparam6 = (!isset($InfoFieldList[8]) ? '' : $InfoFieldList[8]);
$getnomurlparam7 = (!isset($InfoFieldList[9]) ? 0 : $InfoFieldList[9]);
$get_name_url_param_arr = array($getnomurlparam, $getnomurlparam2, 0, -1, 0, '', 0);
if (isset($val['get_name_url_params'])) {
$get_name_url_params = explode(':', $val['get_name_url_params']);
if (!empty($get_name_url_params)) {
$param_num_max = count($get_name_url_param_arr) - 1;
foreach ($get_name_url_params as $param_num => $param_value) {
if ($param_num > $param_num_max) {
break;
}
$get_name_url_param_arr[$param_num] = $param_value;
}
}
}
/**
* @var Product $object
*/
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2, $getnomurlparam3, $getnomurlparam4, $getnomurlparam5, $getnomurlparam6, $getnomurlparam7);
$value = $object->getNomUrl($get_name_url_param_arr[0], $get_name_url_param_arr[1], $get_name_url_param_arr[2], $get_name_url_param_arr[3], $get_name_url_param_arr[4], $get_name_url_param_arr[5], $get_name_url_param_arr[6]);
} else {
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2);
}

View File

@ -3342,7 +3342,6 @@ class Form
}
$outref = $objp->ref;
$outval = '';
$outbarcode = $objp->barcode;
$outqty = 1;
$outdiscount = 0;
@ -3523,48 +3522,52 @@ class Form
}
}
$opt = '<option value="'.$outkey.'"';
$optstart = '<option value="'.$outkey.'"';
if ($selected && $selected == $objp->idprodfournprice) {
$opt .= ' selected';
$optstart .= ' selected';
}
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) {
$opt .= ' disabled';
$optstart .= ' disabled';
}
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
$opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"';
$optstart .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"';
}
$opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
$opt .= '>';
$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
$opt .= $optlabel;
$outval .= $outvallabel;
$outarrayentry = array(
'key' => $outkey,
'value' => $outref,
'label' => $outvallabel,
'qty' => $outqty,
'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
'tva_tx' => $objp->tva_tx,
'default_vat_code' => $objp->default_vat_code,
'discount' => $outdiscount,
'type' => $outtype,
'duration_value' => $outdurationvalue,
'duration_unit' => $outdurationunit,
'disabled' => (empty($objp->idprodfournprice) ? true : false),
'description' => $objp->description
);
$parameters = array(
'objp' => &$objp,
'optstart' => &$optstart,
'optlabel' => &$optlabel,
'outvallabel' => &$outvallabel,
'outarrayentry' => &$outarrayentry
);
$reshook = $hookmanager->executeHooks('selectProduitsFournisseurListOption', $parameters, $this);
$opt .= "</option>\n";
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt;
array_push(
$outarray,
array('key'=>$outkey,
'value'=>$outref,
'label'=>$outval,
'qty'=>$outqty,
'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
'tva_tx'=>$objp->tva_tx,
'default_vat_code'=>$objp->default_vat_code,
'discount'=>$outdiscount,
'type'=>$outtype,
'duration_value'=>$outdurationvalue,
'duration_unit'=>$outdurationunit,
'disabled'=>(empty($objp->idprodfournprice) ? true : false),
'description'=>$objp->description
)
);
$out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "</option>\n";;
array_push($outarray, $outarrayentry);
// Exemple of var_dump $outarray
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"

View File

@ -954,7 +954,7 @@ class FormMail extends Form
$out .= '<input type="hidden" id="message" name="message" value="'.$defaultmessage.'" />';
} else {
if (!isset($this->ckeditortoolbar)) {
$this->ckeditortoolbar = 'dolibarr_notes';
$this->ckeditortoolbar = 'dolibarr_mailings';
}
// Editor wysiwyg

View File

@ -510,6 +510,7 @@ if (!function_exists('ftp_connect')) {
$nboflines = count($contents);
$rawlisthasfailed = false;
$i = 0;
$nbofentries = 0;
while ($i < $nboflines && $i < 1000) {
$vals = preg_split('@ +@', utf8_encode($buff[$i]), 9);
//$vals=preg_split('@ +@','drwxr-xr-x 2 root root 4096 Aug 30 2008 backup_apollon1',9);
@ -527,6 +528,7 @@ if (!function_exists('ftp_connect')) {
// Is it a directory ?
$is_directory = 0;
$is_link = 0;
if ($file == '..') {
$is_directory = 1;
} elseif (!$rawlisthasfailed) {
@ -695,6 +697,7 @@ function dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $sect
$ok = 1;
$conn_id = null;
$mesg="";
if (!is_numeric($ftp_port)) {
$mesg = $langs->transnoentitiesnoconv("FailedToConnectToFTPServer", $ftp_server, $ftp_port);

View File

@ -101,7 +101,7 @@ class Inventory extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax200'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php::::0:-1:0::1', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'),
'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35), // This date is not used so disabled by default.
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),

View File

@ -128,6 +128,28 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
}
}
if ($action == 'confirm_clone' && $confirm == 'yes') {
//$clone_contacts = GETPOST('clone_contacts') ? 1 : 0;
$clone_prog = GETPOST('clone_prog') ? 1 : 0;
$clone_time = GETPOST('clone_time') ? 1 : 0;
$clone_affectation = GETPOST('clone_affectation') ? 1 : 0;
$clone_change_dt = GETPOST('clone_change_dt') ? 1 : 0;
$clone_notes = GETPOST('clone_notes') ? 1 : 0;
$clone_file = GETPOST('clone_file') ? 1 : 0;
$result = $object->createFromClone($user, $object->id, $object->fk_project, $object->fk_task_parent, $clone_change_dt, $clone_affectation, $clone_time, $clone_file, $clone_notes, $clone_prog);
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// Load new object
$newobject = new Task($db);
$newobject->fetch($result);
$newobject->fetch_optionals();
$newobject->fetch_thirdparty(); // Load new object
$object = $newobject;
$action = '';
}
}
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->supprimer) {
$result = $projectstatic->fetch($object->fk_project);
$projectstatic->fetch_thirdparty();
@ -205,6 +227,7 @@ $help_url = '';
llxHeader('', $title, $help_url);
if ($id > 0 || !empty($ref)) {
$res = $object->fetch_optionals();
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
@ -385,6 +408,22 @@ if ($id > 0 || !empty($ref)) {
//$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
//$arrayofuseridoftask=$object->getListContactId('internal');
if ($action == 'clone') {
$formquestion = array(
'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true),
array('type' => 'checkbox', 'name' => 'clone_change_dt', 'label' => $langs->trans("CloneChanges"), 'value' => true),
array('type' => 'checkbox', 'name' => 'clone_affectation', 'label' => $langs->trans("CloneAffectation"), 'value' => true),
array('type' => 'checkbox', 'name' => 'clone_prog', 'label' => $langs->trans("CloneProgression"), 'value' => true),
array('type' => 'checkbox', 'name' => 'clone_time', 'label' => $langs->trans("CloneTimes"), 'value' => true),
array('type' => 'checkbox', 'name' => 'clone_file', 'label' => $langs->trans("CloneFile"), 'value' => true),
);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ToClone"), $langs->trans("ConfirmCloneTask"), "confirm_clone", $formquestion, '', 1, 300, 590);
}
$head = task_prepare_head($object);
if ($action == 'edit' && $user->rights->projet->creer) {
@ -628,6 +667,7 @@ if ($id > 0 || !empty($ref)) {
// Modify
if ($user->rights->projet->creer) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'&withproject='.((int) $withproject).'">'.$langs->trans('Modify').'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken().'&withproject='.((int) $withproject).'">'.$langs->trans('Clone').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Modify').'</a>';
}

View File

@ -532,7 +532,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken(), '', $permissiontoadd);
/*
if ($permissiontoadd) {