Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
fcabe67e4b
@ -181,7 +181,7 @@ if (empty($reshook))
|
||||
if ($action == 'setorder_min_amount')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->order_min_amount=GETPOST('order_min_amount');
|
||||
$object->order_min_amount=price2num(GETPOST('order_min_amount','alpha'));
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -423,15 +423,21 @@ if ($object->id > 0)
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if ($object->client)
|
||||
{
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
|
||||
{
|
||||
print '<!-- Minimim amount for orders -->'."\n";
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2388,7 +2388,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Total HT
|
||||
$alert = '';
|
||||
if($object->total_ht < $object->thirdparty->order_min_amount) {
|
||||
if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) {
|
||||
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
|
||||
}
|
||||
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
|
||||
@ -455,7 +455,7 @@ while($j<$numlt)
|
||||
|
||||
|
||||
// Payment Salary
|
||||
if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
||||
{
|
||||
if (! $mode || $mode != 'sconly')
|
||||
{
|
||||
|
||||
@ -3789,7 +3789,7 @@ class Facture extends CommonInvoice
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("CustomerBillsUnpaid");
|
||||
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills';
|
||||
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=billing&leftmenu=customers_bills';
|
||||
$response->img=img_object('',"bill");
|
||||
|
||||
$generic_facture = new Facture($this->db);
|
||||
|
||||
@ -577,14 +577,14 @@ if ($resql)
|
||||
if ($search_zip) $param.='&search_zip='.urlencode($search_zip);
|
||||
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
|
||||
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
|
||||
if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category);
|
||||
if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category);
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
|
||||
if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1);
|
||||
if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2);
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($show_files) $param.='&show_files='.urlencode($show_files);
|
||||
if ($option) $param.="&search_option=".urlencode($option);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
@ -47,7 +47,7 @@ $projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : GETPOST
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'salaries', '', '', 'payment');
|
||||
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||
|
||||
$object = new PaymentSalary($db);
|
||||
|
||||
|
||||
@ -44,8 +44,9 @@ $action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'salaries', $id, '');
|
||||
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||
|
||||
|
||||
// Get parameters
|
||||
|
||||
@ -148,7 +148,7 @@ if ($result)
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->salaries->payment->write)
|
||||
if (! empty($user->rights->salaries->write))
|
||||
{
|
||||
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/salaries/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewSalaryPayment').'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
|
||||
@ -41,18 +41,6 @@ $socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||
|
||||
// Other security check
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
if ($userid > 0)
|
||||
{
|
||||
if (empty($user->rights->salaries->payment->readall) && ! in_array($userid, $childids))
|
||||
{
|
||||
accessforbidden();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$nowyear=strftime("%Y", dol_now());
|
||||
$year = GETPOST('year')>0?GETPOST('year'):$nowyear;
|
||||
//$startyear=$year-2;
|
||||
@ -77,11 +65,6 @@ print load_fiche_titre($title, $mesg);
|
||||
dol_mkdir($dir);
|
||||
|
||||
$useridtofilter=$userid; // Filter from parameters
|
||||
if (empty($useridtofilter))
|
||||
{
|
||||
$useridtofilter=$childids;
|
||||
if (! empty($user->rights->salaries->payment->readall)) $useridtofilter=0;
|
||||
}
|
||||
|
||||
$stats = new SalariesStats($db, $socid, $useridtofilter);
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ while($j<$numlt)
|
||||
|
||||
|
||||
// Payment Salary
|
||||
if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
||||
{
|
||||
if (! $mode || $mode != 'sconly')
|
||||
{
|
||||
|
||||
@ -42,7 +42,7 @@ if (GETPOST('addfile','alpha'))
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
|
||||
|
||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid);
|
||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0);
|
||||
$action='presend';
|
||||
}
|
||||
|
||||
|
||||
@ -672,11 +672,22 @@ class ExtraFields
|
||||
$params='';
|
||||
}
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql_del.= " WHERE name = '".$attrname."'";
|
||||
$sql_del.= " AND entity = ".($entity===''?$conf->entity:$entity);
|
||||
$sql_del.= " AND elementtype = '".$elementtype."'";
|
||||
|
||||
if ($entity === '' || $entity != '0')
|
||||
{
|
||||
// We dont want on all entities, we delete all and current
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql_del.= " WHERE name = '".$attrname."'";
|
||||
$sql_del.= " AND entity IN (0, ".($entity===''?$conf->entity:$entity).")";
|
||||
$sql_del.= " AND elementtype = '".$elementtype."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
// We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity)
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql_del.= " WHERE name = '".$attrname."'";
|
||||
$sql_del.= " AND entity = 0";
|
||||
$sql_del.= " AND elementtype = '".$elementtype."'";
|
||||
}
|
||||
$resql1=$this->db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(";
|
||||
|
||||
@ -954,6 +954,7 @@ class FormMail extends Form
|
||||
|
||||
if (count($validpaymentmethod) > 0 && $paymenturl)
|
||||
{
|
||||
$langs->load('other');
|
||||
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n',"\n",$langs->transnoentities("PredefinedMailContentLink", $paymenturl));
|
||||
$this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl;
|
||||
}
|
||||
|
||||
@ -6093,7 +6093,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
{
|
||||
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$outputlangs->load('paypal');
|
||||
$outputlangs->loadLangs(array('paypal','other'));
|
||||
$typeforonlinepayment='free';
|
||||
if (is_object($object) && $object->element == 'commande') $typeforonlinepayment='order';
|
||||
if (is_object($object) && $object->element == 'facture') $typeforonlinepayment='invoice';
|
||||
|
||||
@ -198,11 +198,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&mainmenu=billing', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
||||
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=billing', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
||||
-- Special expenses
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=billing', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=billing', 'Salaries', 1, 'salaries', '$user->rights->salaries->payment->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->payment->write', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/stats/index.php?leftmenu=tax_salary', 'Statistics', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=billing', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=billing', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/stats/index.php?leftmenu=tax_salary', 'Statistics', 2, 'companies', '$user->rights->salaries->read', '', 0, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'billing', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&mainmenu=billing', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
|
||||
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
|
||||
|
||||
@ -152,7 +152,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
if (! empty($conf->loan->enabled)) $menuqualified++;
|
||||
$tmpentry=array(
|
||||
'enabled'=>$menuqualified,
|
||||
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
|
||||
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
|
||||
'module'=>'facture|supplier_invoice|don|tax|salaries|loan');
|
||||
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
@ -883,7 +883,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire));
|
||||
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire));
|
||||
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax');
|
||||
|
||||
// Social contributions
|
||||
@ -931,10 +931,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (! empty($conf->salaries->enabled))
|
||||
{
|
||||
$langs->load("salaries");
|
||||
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=billing",$langs->trans("Salaries"),1,$user->rights->salaries->payment->read, '', $mainmenu, 'tax_salary');
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->payment->write);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->payment->read);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"),2,$user->rights->salaries->payment->read);
|
||||
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=billing",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary');
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->write);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"),2,$user->rights->salaries->read);
|
||||
}
|
||||
|
||||
// Loan
|
||||
|
||||
@ -50,7 +50,7 @@ class modSalaries extends DolibarrModules
|
||||
$this->db = $db;
|
||||
$this->numero = 510; // Perms from 501..519
|
||||
|
||||
$this->family = "hr";
|
||||
$this->family = "compta";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
@ -99,55 +99,32 @@ class modSalaries extends DolibarrModules
|
||||
$r=0;
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 501;
|
||||
$this->rights[$r][1] = 'Read employee contracts/salaries';
|
||||
$this->rights[$r][0] = 511;
|
||||
$this->rights[$r][1] = 'Read payments of employee salaries';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'read';
|
||||
$this->rights[$r][5] = '';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 502;
|
||||
$this->rights[$r][1] = 'Create/modify employee contracts/salaries';
|
||||
$this->rights[$r][0] = 512;
|
||||
$this->rights[$r][1] = 'Create/modify payments of empoyee salaries';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'write';
|
||||
$this->rights[$r][5] = '';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 511;
|
||||
$this->rights[$r][1] = 'Read payment of salaries';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'payment';
|
||||
$this->rights[$r][5] = 'read';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 512;
|
||||
$this->rights[$r][1] = 'Create/modify payment of salaries';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'payment';
|
||||
$this->rights[$r][5] = 'write';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 514;
|
||||
$this->rights[$r][1] = 'Delete contracts/salaries';
|
||||
$this->rights[$r][1] = 'Delete payments of employee salary';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'delete';
|
||||
$this->rights[$r][5] = '';
|
||||
|
||||
$this->rights[$r][0] = 515;
|
||||
$this->rights[$r][1] = 'Read all salaries';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'payment';
|
||||
$this->rights[$r][5] = 'readall';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 517;
|
||||
$this->rights[$r][1] = 'Export employee contracts and salaries payments';
|
||||
$this->rights[$r][1] = 'Export payments of employee salaries';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'export';
|
||||
|
||||
@ -109,7 +109,7 @@ if (empty($reshook))
|
||||
if ($action == 'setsupplier_order_min_amount')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->supplier_order_min_amount=GETPOST('supplier_order_min_amount');
|
||||
$object->supplier_order_min_amount=price2num(GETPOST('supplier_order_min_amount','alpha'));
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -298,15 +298,17 @@ if ($object->id > 0)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if (! empty($conf->fournisseur->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
|
||||
{
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (! empty($conf->categorie->enabled))
|
||||
|
||||
@ -2117,7 +2117,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("SupplierBillsToPay");
|
||||
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=suppliers_bills';
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
||||
$response->img=img_object($langs->trans("Bills"),"bill");
|
||||
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
|
||||
@ -2120,7 +2120,7 @@ elseif (! empty($object->id))
|
||||
|
||||
// Total
|
||||
$alert = '';
|
||||
if($object->total_ht < $object->thirdparty->supplier_order_min_amount) {
|
||||
if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->supplier_order_min_amount) {
|
||||
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount));
|
||||
}
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans("AmountHT").'</td>';
|
||||
|
||||
@ -270,11 +270,11 @@ if (empty($user->societe_id))
|
||||
DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
|
||||
DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',
|
||||
DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders',
|
||||
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy&leftmenu=customers_bills',
|
||||
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills',
|
||||
DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
|
||||
DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter',
|
||||
DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers',
|
||||
DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=accountancy&leftmenu=suppliers_bills',
|
||||
DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills',
|
||||
DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=',
|
||||
DOL_URL_ROOT.'/projet/list.php?mainmenu=project',
|
||||
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
|
||||
|
||||
@ -791,11 +791,9 @@ Permission401=Read discounts
|
||||
Permission402=Create/modify discounts
|
||||
Permission403=Validate discounts
|
||||
Permission404=Delete discounts
|
||||
Permission501=Read employee contracts/salaries
|
||||
Permission502=Create/modify employee contracts/salaries
|
||||
Permission511=Read payment of salaries
|
||||
Permission512=Create/modify payment of salaries
|
||||
Permission514=Delete salaries
|
||||
Permission511=Read payments of salaries
|
||||
Permission512=Create/modify payments of salaries
|
||||
Permission514=Delete payments of salaries
|
||||
Permission517=Export salaries
|
||||
Permission520=Read Loans
|
||||
Permission522=Create/modify loans
|
||||
|
||||
@ -70,7 +70,7 @@ $offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$search_all=GETPOST('search_all', 'alphanohtml');
|
||||
$search_all=GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
|
||||
$search_categ=GETPOST("search_categ",'alpha');
|
||||
$search_ref=GETPOST("search_ref");
|
||||
$search_label=GETPOST("search_label");
|
||||
|
||||
@ -361,7 +361,7 @@ if ($sql_select)
|
||||
{
|
||||
$resql=$db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param="&socid=".$socid."&type_element=".$type_element;
|
||||
@ -384,7 +384,7 @@ if ($sql_select)
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre nowrap center">'; // date
|
||||
print $formother->select_month($month?$month:-1,'month',1);
|
||||
print $formother->select_month($month?$month:-1, 'month', 1, 0, 'valignmiddle');
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
|
||||
@ -424,11 +424,10 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
|
||||
@ -550,13 +550,17 @@ if (empty($reshook))
|
||||
|
||||
$db->begin();
|
||||
|
||||
if (empty($newcu)) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity;
|
||||
} else {
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account";
|
||||
$sql.= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'";
|
||||
$sql.= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
|
||||
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$num = $db->num_rows($resql);
|
||||
if (empty($num))
|
||||
if (empty($num) && !empty($newcu))
|
||||
{
|
||||
$societeaccount = new SocieteAccount($db);
|
||||
$societeaccount->fk_soc = $object->id;
|
||||
|
||||
@ -23,10 +23,10 @@ if (empty($conf) || ! is_object($conf))
|
||||
}
|
||||
|
||||
// Sale representative
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('SalesRepresentatives');
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
|
||||
$listsalesrepresentatives=$object->getSalesRepresentatives($user);
|
||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||
|
||||
@ -48,13 +48,12 @@ $cancel = GETPOST('cancel','alpha');
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
||||
// Ok if user->rights->salaries->read or user->rights->salaries->payment->write or user->rights->hrm->read
|
||||
// Ok if user->rights->salaries->read or user->rights->hrm->read
|
||||
//$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2);
|
||||
$ok=false;
|
||||
if ($user->id == $id) $ok=true; // A user can always read its own card
|
||||
if ($user->rights->salaries->read) $ok=true;
|
||||
if ($user->rights->salaries->payment->write) $ok=true;
|
||||
if ($user->rights->hrm->read) $ok=true;
|
||||
if (! empty($user->rights->salaries->read)) $ok=true;
|
||||
if (! empty($user->rights->hrm->read)) $ok=true;
|
||||
if (! $ok)
|
||||
{
|
||||
accessforbidden();
|
||||
@ -293,7 +292,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
* Last salaries
|
||||
*/
|
||||
if (! empty($conf->salaries->enabled) &&
|
||||
($user->rights->salaries->read || ($user->rights->salaries->read && $object->id == $user->id))
|
||||
($user->rights->salaries->read && $object->id == $user->id)
|
||||
)
|
||||
{
|
||||
$salary = new PaymentSalary($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user