Merge branch '13.0' into 13b6

This commit is contained in:
Alexandre SPANGARO 2021-01-06 06:00:58 +01:00
commit 7e5b798a1d
30 changed files with 162 additions and 108 deletions

View File

@ -16,7 +16,7 @@ NEW: Accountancy - add options to disable binding on sales, purchases & expense
NEW: Accountancy balance - add a menu entry to show subtotal by group
NEW: Accountancy - change menu disposition
NEW: Accountancy - on transfers, select the periodicity by default
NEW: Accountancy - Add export for Gestinum (v3 & v5)
NEW: Accountancy - Add export for Gestinum (v3 & v5) #15180
NEW: new currency rate editor
NEW: Solve blocking feature. Can increase stock of a Kit without changing subproduct stock.
NEW: add a widget to show the customers with outstanding limits reached
@ -163,7 +163,7 @@ NEW: Support for Samba4 AD
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS Gift Receipt
NEW: TakePOS Multicurrency compatibility
NEW: the global header of a website can also have dynamic content
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
NEW: ticket classification on create from email collector
@ -173,11 +173,11 @@ NEW: VAT rate for Angola #15606
NEW: VAT and juridical status for Algeria
NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection
NEW: Weighing Scale compatibility with TakePOS connector
NEW: website - global header of a website can also have dynamic content
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
NEW: add clone button on miscellaneous payment
NEW: #15065 Add option to put the product label in bold in the PDF templates if configured
NEW: Add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
NEW: add clone button on miscellaneous payment
NEW: add option to put the product label in bold in the PDF templates if configured #15065
NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
For developers:

View File

@ -692,7 +692,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
if ((!GETPOSTISSET($value) || GETPOST($value) == '')
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
&& (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
&& ($id != 10 || ($listfield[$f] != 'code' && $listfield[$f] != 'note')) // Field code and note is not mandatory for dictionary table 10
)
) {
$ok = 0;
@ -757,9 +757,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code
if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code for tax dictionary
{
$_POST["code"] = preg_replace('/\s/', '', $_POST["code"]);
$_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]);
}
// If check ok and action add, add the line
@ -826,8 +826,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
// Clean $_POST array, we keep only id of dictionary
if ($id == 10 && GETPOST('country', 'int') > 0) {
$search_country_id = GETPOST('country', 'int');
}
$_POST = array('id'=>$id);
} else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');

View File

@ -214,6 +214,7 @@ llxHeader('', $langs->trans("Agenda"), $help_url);
$form = new Form($db);
$companystatic = new Societe($db);
$contactstatic = new Contact($db);
$userstatic = new User($db);
$now = dol_now();
$nowarray = dol_getdate($now);
@ -1071,7 +1072,6 @@ if (count($listofextcals))
{
$event->id = $icalevent['UID'];
$event->ref = $event->id;
$userId = $userstatic->findUserIdByEmail($namecal);
if (!empty($userId) && $userId > 0)
{

View File

@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks'));
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products'));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -549,16 +549,17 @@ if (!empty($conf->multicompany->enabled) && is_object($mc))
print '<br>';
$listofchoices = array(
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills'),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills'),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'),
'selectsocialcontributions'=>array('label'=>'SocialContributions'),
'selectvariouspayment'=>array('label'=>'VariousPayment'),
'selectloanspayment'=>array('label'=>'PaymentLoan'),
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled)),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled)),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled)),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled)),
'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled)),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => !empty($conf->salaries->enabled)),
'selectvariouspayment'=>array('label'=>'VariousPayment', 'enabled' => !empty($conf->banque->enabled)),
'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => !empty($conf->loan->enabled)),
);
foreach ($listofchoices as $choice => $val) {
if (empty($val['enabled'])) continue; // list not qualified
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
}

View File

@ -710,10 +710,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Price
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
// Received or paid back
// Received + already paid
print '<td class="right">'.price($sign * $paiement);
if ($creditnotes) print '+'.price($creditnotes);
if ($deposits) print '+'.price($deposits);
if ($creditnotes) print '<span class="opacitymedium">+'.price($creditnotes).'</span>';
if ($deposits) print '<span class="opacitymedium">+'.price($deposits).'</span>';
print '</td>';
// Remain to take or to pay back

View File

@ -374,8 +374,7 @@ if (empty($reshook))
$action = 'create';
}
}
} elseif ($action == 'classin' && $user->rights->contrat->creer)
{
} elseif ($action == 'classin' && $user->rights->contrat->creer) {
$object->setProject(GETPOST('projectid'));
}

View File

@ -137,10 +137,13 @@ class box_fournisseurs extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedSuppliers"),
);
if ($num == 0) {
$langs->load("suppliers");
$this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedSuppliers"),
);
}
$this->db->free($result);
} else {

View File

@ -6845,6 +6845,7 @@ abstract class CommonObject
break;
}
// Output value of the current field
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate')
{
$extrafields_collapse_num = '';

View File

@ -90,7 +90,7 @@ abstract class DoliDB implements Database
*/
public function idate($param, $gm = 'tzserver')
{
// TODO $param should be gmt, so we should add tzouptut to 'gmt' instead of default 'tzserver'
// TODO $param should be gmt, so we should add $gm to 'gmt' instead of default 'tzserver'
return dol_print_date($param, "%Y-%m-%d %H:%M:%S", $gm);
}

View File

@ -685,18 +685,6 @@ class DoliDBPgsql extends DoliDB
return pg_escape_string($stringtoencode);
}
/**
* Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
*
* @param string $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS
*/
public function idate($param)
{
return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
}
/**
* Format a SQL IF
*

View File

@ -1438,9 +1438,15 @@ function complete_elementList_with_modules(&$elementList)
$dirmod[$i] = $dir;
//print "x".$modName." ".$orders[$i]."\n<br>";
if (!empty($objMod->module_parts['contactelement'])) {
$elementList[$objMod->name] = $langs->trans($objMod->name);
}
if (!empty($objMod->module_parts['contactelement'])) {
if (is_array($objMod->module_parts['contactelement'])) {
foreach ($objMod->module_parts['contactelement'] as $elem => $title) {
$elementList[$elem] = $langs->trans($title);
}
} else {
$elementList[$objMod->name] = $langs->trans($objMod->name);
}
}
$j++;
$i++;

View File

@ -4615,7 +4615,7 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
}
if ((int) $limit > 0 && empty($hideselectlimit))
{
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000,25000:25000';
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2';
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;

View File

@ -2526,13 +2526,15 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '')
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
$badgeClass .= 'badge-danger';
if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("Expected").' '.$progressCalculated.'%';
if (empty($tooltip)) {
$tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';
}
} elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
$badgeClass .= 'badge-warning';
if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("Expected").' '.$progressCalculated.'%';
if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';
} else {
$badgeClass .= 'badge-success';
if (empty($tooltip)) $tooltip = $task->progress.'% >= '.$langs->trans("Expected").' '.$progressCalculated.'%';
if (empty($tooltip)) $tooltip = $task->progress.'% >= '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';
}
}
}

View File

@ -81,7 +81,7 @@ function shipping_prepare_head($object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref);
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id;

View File

@ -62,7 +62,11 @@ if ($absolute_discount > 0) {
$text .= ' ('.$addabsolutediscount.')';
}
print '<div class="inline-block clearboth">'.$text.'</div>';
if ($isNewObject) {
print '<br>'.$text;
} else {
print '<div class="inline-block clearboth">'.$text.'</div>';
}
} else {
// Discount available of type fixed amount (not credit note)
$more = '('.$addabsolutediscount.')';
@ -85,7 +89,11 @@ if ($absolute_creditnote > 0) {
$text .= '('.$addabsolutediscount.')';
}
print '<div class="inline-block clearboth">'.$text.'</div>';
if ($isNewObject) {
print '<br>'.$text;
} else {
print '<div class="inline-block clearboth">'.$text.'</div>';
}
} else { // We can add a credit note on a down payment or standard invoice or situation invoice
// There is credit notes discounts available
$more = $isInvoice && !$isNewObject ? ' ('.$viewabsolutediscount.')' : '';

View File

@ -80,7 +80,9 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
{
if ($result > 0 && $id > 0)
{
$result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]);
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
}
if ($result >= 0)

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills'));
$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills', 'products'));
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
@ -340,7 +340,7 @@ if ($resql)
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status);
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';

View File

@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers'));
$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers', 'products'));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -77,7 +77,7 @@ if (!empty($useragent))
// Check PHP version
$arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0);
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower)
{
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
@ -105,7 +105,7 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) // We must keep $_GE
}
// Check if sessions enabled
// Check if session_id is enabled
if (!function_exists("session_id"))
{
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions")."<br>\n";
@ -115,7 +115,7 @@ if (!function_exists("session_id"))
}
// Check if GD supported (we need GD for image conversion)
// Check if GD is supported (we need GD for image conversion)
if (!function_exists("imagecreate"))
{
$langs->load("errors");
@ -126,7 +126,7 @@ if (!function_exists("imagecreate"))
}
// Check if Curl supported
// Check if Curl is supported
if (!function_exists("curl_init"))
{
$langs->load("errors");
@ -145,7 +145,7 @@ if (!function_exists("easter_date"))
}
// Check if UTF8 supported
// Check if UTF8 is supported
if (!function_exists("utf8_encode"))
{
$langs->load("errors");
@ -201,7 +201,7 @@ if ($memmaxorig != '')
}
// If config file present and filled
// If that config file is present and filled
clearstatcache();
if (is_readable($conffile) && filesize($conffile) > 8)
{

View File

@ -85,6 +85,7 @@ ProgressCalculated=Progress on consumption
WhichIamLinkedTo=which I'm linked to
WhichIamLinkedToProject=which I'm linked to project
Time=Time
TimeConsumed=Consumed
ListOfTasks=List of tasks
GoToListOfTimeConsumed=Go to list of time consumed
GanttView=Gantt View

View File

@ -697,7 +697,7 @@ class MyObject extends CommonObject
return -1;
}*/
return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MYOBJECT_CLOSE');
return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MYOBJECT_CANCEL');
}
/**

View File

@ -158,7 +158,7 @@ if ($object->id > 0)
$head = myobjectPrepareHead($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, 'object_'.$object->picto);
print dol_get_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, $object->picto);
// Object card
// ------------------------------------------------------------

View File

@ -466,40 +466,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
// Send
if (empty($user->socid)) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle');
}
// Back to draft
if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes">'.$langs->trans("SetToDraft").'</a>';
}
print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd);
}
// Modify
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd);
// Validate
if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) {
if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0))
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes">'.$langs->trans("Validate").'</a>';
} else {
$langs->load("errors");
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
}
if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd);
} else {
$langs->load("errors");
//print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0);
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
}
}
// Clone
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=myobject">'.$langs->trans("ToClone").'</a>'."\n";
}
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd);
/*
if ($permissiontoadd)
@ -521,12 +510,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
*/
// Delete (need delete permission, or if draft, just need create/modify permission)
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd))
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
}
print '</div>'."\n";
}

View File

@ -202,9 +202,9 @@ $arrayfields = array(
'p.volume_units'=>array('label'=>$langs->trans('VolumeUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME) && $type != '1'), 'position'=>31),
'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS)), 'position'=>32),
'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES), 'position'=>40),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>41),
'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>42),
'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES), 'position'=>41),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>42),
'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44),
'p.cost_price'=>array('label'=>$langs->trans("CostPrice"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>45),
'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>50),
@ -378,7 +378,7 @@ if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell != -1) $sql .= " AND p.tosell = ".((int) $search_tosell);
if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) $sql .= " AND p.tobuy = ".((int) $search_tobuy);
if (isset($search_tobatch) && dol_strlen($search_tobatch) > 0 && $search_tobatch != -1) $sql .= " AND p.tobatch = ".((int) $search_tobatch);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate, 1);
if (dol_strlen($canvas) > 0) $sql .= " AND p.canvas = '".$db->escape($canvas)."'";
if ($catid > 0) $sql .= " AND cp.fk_categorie = ".$catid;
if ($catid == -2) $sql .= " AND cp.fk_categorie IS NULL";
@ -934,7 +934,7 @@ if ($resql)
print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['p.tva_tx']['checked'])) {
print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], 'p.tva_tx', "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['p.pmp']['checked'])) {
print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');

View File

@ -67,11 +67,6 @@ if ($id > 0 || !empty($ref))
$objectsrc = new CommandeFournisseur($db);
$objectsrc->fetch($object->$typeobject->id);
}
if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled))
{
$objectsrc = new Propal($db);
$objectsrc->fetch($object->$typeobject->id);
}
}
@ -83,7 +78,9 @@ if ($action == 'addcontact' && $user->rights->reception->creer)
{
if ($result > 0 && $id > 0)
{
$result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]);
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
}
if ($result >= 0)

View File

@ -505,7 +505,7 @@ if ($resql)
if ($search_town) $param .= "&amp;search_town=".urlencode($search_town);
if ($search_zip) $param .= "&amp;search_zip=".urlencode($search_zip);
if ($search_state) $param .= "&amp;search_state=".urlencode($search_state);
if ($search_status) $param .= "&amp;search_status=".urlencode($search_status);
if ($search_status != '') $param .= "&amp;search_status=".urlencode($search_status);
if ($search_country) $param .= "&amp;search_country=".urlencode($search_country);
if ($search_type_thirdparty) $param .= "&amp;search_type_thirdparty=".urlencode($search_type_thirdparty);
if ($search_ref_supplier) $param .= "&amp;search_ref_supplier=".urlencode($search_ref_supplier);

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019-2021 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019-2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -57,6 +57,14 @@ $project_ref = GETPOST('project_ref', 'alpha');
$search_societe = GETPOST('search_societe', 'alpha');
$search_fk_project = GETPOST('search_fk_project', 'int') ?GETPOST('search_fk_project', 'int') : GETPOST('projectid', 'int');
$search_fk_status = GETPOST('search_fk_statut', 'array');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_dateread_start = dol_mktime(0, 0, 0, GETPOST('search_dateread_startmonth', 'int'), GETPOST('search_dateread_startday', 'int'), GETPOST('search_dateread_startyear', 'int'));
$search_dateread_end = dol_mktime(23, 59, 59, GETPOST('search_dateread_endmonth', 'int'), GETPOST('search_dateread_endday', 'int'), GETPOST('search_dateread_endyear', 'int'));
$search_dateclose_start = dol_mktime(0, 0, 0, GETPOST('search_dateclose_startmonth', 'int'), GETPOST('search_dateclose_startday', 'int'), GETPOST('search_dateclose_startyear', 'int'));
$search_dateclose_end = dol_mktime(23, 59, 59, GETPOST('search_dateclose_endmonth', 'int'), GETPOST('search_dateclose_endday', 'int'), GETPOST('search_dateclose_endyear', 'int'));
$mode = GETPOST('mode', 'alpha');
// Load variable for pagination
@ -170,6 +178,12 @@ if (empty($reshook))
}
$toselect = '';
$search_array_options = array();
$search_date_start = '';
$search_date_end = '';
$search_dateread_start = '';
$search_dateread_end = '';
$search_dateclose_start = '';
$search_dateclose_end = '';
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
@ -348,6 +362,14 @@ foreach ($search as $key => $val)
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2);
if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'";
if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'";
if ($search_dateread_end) $sql .= " AND t.date_read <= '".$db->idate($search_dateread_end)."'";
if ($search_dateclose_start) $sql .= " AND t.date_close >= '".$db->idate($search_dateclose_start)."'";
if ($search_dateclose_end) $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'";
if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
$sql .= " AND (t.fk_user_assign = ".$user->id;
if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql .= " OR t.fk_user_create = ".$user->id;
@ -539,6 +561,13 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
if ($socid) $param .= '&socid='.urlencode($socid);
if ($projectid) $param .= '&projectid='.urlencode($projectid);
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
if ($search_dateread_start) $param .= '&search_dateread_start='.urlencode($search_dateread_start);
if ($search_dateread_end) $param .= '&search_dateread_end='.urlencode($search_dateread_end);
if ($search_dateclose_start) $param .= '&search_dateclose_start='.urlencode($search_dateclose_start);
if ($search_dateclose_end) $param .= '&search_dateclose_end='.urlencode($search_dateclose_end);
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
@ -655,7 +684,35 @@ foreach ($object->fields as $key => $val)
print '</td>';
} elseif ($key == "fk_soc") {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
} else {
} elseif ($key == "datec" || $key == 'date_read' || $key == 'date_close'){
print '<td class="liste_titre center">';
print '<div class="nowrap">';
switch ($key){
case 'datec':
print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
break;
case 'date_read':
print $form->selectDate($search_dateread_start ?: -1, 'search_dateread_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
break;
case 'date_close':
print $form->selectDate($search_dateclose_start ?: -1, 'search_dateclose_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
}
print '</div>';
print '<div class="nowrap">';
switch ($key){
case 'datec':
print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
break;
case 'date_read':
print $form->selectDate($search_dateread_end ?: -1, 'search_dateread_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
break;
case 'date_close':
print $form->selectDate($search_dateclose_end ?: -1, 'search_dateclose_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
}
print '</div>';
print '</td>';
}
else {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) {

View File

@ -345,7 +345,7 @@ if ($catid > 0) $sql .= " AND cu.fk_categorie = ".((int) $catid);
if ($catid == -2) $sql .= " AND cu.fk_categorie IS NULL";
if ($search_categ > 0) $sql .= " AND cu.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql .= " AND cu.fk_categorie IS NULL";
if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND u.fk_user IN (".join(',', $childids).")";
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks

View File

@ -153,7 +153,7 @@ if ($resql) {
if ($targettype == 'contacts') {
$oldcid = $obj->cid;
}
$oldlang = $obj->lang;
$oldlang = $obj->default_lang;
$oldtarget = (empty($obj->cfirstname) && empty($obj->clastname)) ? $obj->name : ($obj->clastname." ".$obj->cfirstname);
$message = '';
$total = 0;