Merge branch 'develop' into nospaceaftercomma
This commit is contained in:
commit
f83ee43a19
@ -303,13 +303,15 @@ class ChargeSociales extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Met a jour une charge sociale
|
* Update social or fiscal contribution
|
||||||
*
|
*
|
||||||
* @param User $user Utilisateur qui modifie
|
* @param User $user User that modify
|
||||||
* @return int <0 si erreur, >0 si ok
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user)
|
function update($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
|
$error=0;
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
||||||
@ -323,16 +325,37 @@ class ChargeSociales extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
|
||||||
|
if (! $resql) {
|
||||||
|
$error++; $this->errors[]="Error ".$this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
if (! $notrigger)
|
||||||
return 1;
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('SOCIALCHARGES_MODIFY',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->db->commit();
|
||||||
$this->db->rollback();
|
return 1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -534,7 +534,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($massaction == 'confirm_createbills')
|
if ($massaction == 'confirm_createbills') // Create bills from orders
|
||||||
{
|
{
|
||||||
$orders = GETPOST('toselect','array');
|
$orders = GETPOST('toselect','array');
|
||||||
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
||||||
@ -801,7 +801,6 @@ if ($massaction == 'confirm_createbills')
|
|||||||
|
|
||||||
if (!$error && $massaction == 'cancelorders')
|
if (!$error && $massaction == 'cancelorders')
|
||||||
{
|
{
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$nbok = 0;
|
$nbok = 0;
|
||||||
|
|||||||
@ -2225,6 +2225,10 @@ class Form
|
|||||||
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
|
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
|
||||||
else $textifempty.=$langs->trans("All");
|
else $textifempty.=$langs->trans("All");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
|
||||||
|
}
|
||||||
if ($showempty) $out.='<option value="0" selected>'.$textifempty.'</option>';
|
if ($showempty) $out.='<option value="0" selected>'.$textifempty.'</option>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|||||||
@ -98,6 +98,7 @@ $extralabels_task=$extrafields_task->fetch_name_optionals_label($object->table_e
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel', 'alpha')) { $action=''; }
|
if (GETPOST('cancel', 'alpha')) { $action=''; }
|
||||||
|
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_generateinvoice') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid, 'projectid'=>$projectid);
|
$parameters=array('socid'=>$socid, 'projectid'=>$projectid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -300,7 +301,7 @@ elseif (GETPOST('project_ref', 'alpha'))
|
|||||||
$withproject=1;
|
$withproject=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($massaction == 'generateinvoice')
|
if ($massaction == 'confirm_generateinvoice')
|
||||||
{
|
{
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
@ -754,7 +755,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
$arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1);
|
$arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1);
|
||||||
$arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1);
|
$arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1);
|
||||||
$arrayfields['value'] =array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled)?0:1));
|
$arrayfields['value'] =array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled)?0:1));
|
||||||
$arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1));
|
$arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1) && $projectstatic->bill_time));
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@ -771,7 +772,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
//if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
if (in_array($massaction, array('presend','predelete','generateinvoice'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,6 +811,51 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
||||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||||
|
|
||||||
|
if ($massaction == 'generateinvoice')
|
||||||
|
{
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
//var_dump($_REQUEST);
|
||||||
|
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%" >';
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="titlefield">';
|
||||||
|
print $langs->trans('DateInvoice');
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectDate('', '', '', '', '', '', 1, 1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
if ($conf->service->enabled)
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $langs->trans('Service');
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
/*print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $langs->trans('ValidateInvoices');
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';*/
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
print '<div class="center">';
|
||||||
|
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoice').'"> ';
|
||||||
|
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||||
|
print '</div>';
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of time spent
|
* List of time spent
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user