diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 9833a1c01b1..0dcefdcc0ee 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -113,7 +113,7 @@ $tabcond[32]= ! empty($conf->accounting->enabled); // List of help for fields $tabhelp=array(); -$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode")); +$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"), 'category_type'=>$langs->trans("SetToYesIfGroupIsComputationOfOtherGroups"), 'formula'=>$langs->trans("EnterCalculationRuleIfPreviousFieldIsYes")); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 1ebd512e772..5e684b4091d 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -1,5 +1,6 @@ + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -143,7 +144,7 @@ if ($action == 'initbarcodeproducts') $nextvalue=$modBarCodeProduct->getNextValue($productstatic,''); //print 'Set value '.$nextvalue.' to product '.$productstatic->id." ".$productstatic->ref." ".$productstatic->type."
\n"; - $result=$productstatic->setValueFrom('barcode', $nextvalue, '', '', 'date', '', $user, 'PRODUCT_MODIFY'); + $result=$productstatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'PRODUCT_MODIFY'); $nbtry++; if ($result > 0) $nbok++; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ab7e0826553..5681b0c339c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -925,6 +925,12 @@ if (empty($reshook)) foreach($facture_source->lines as $line) { + // Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) { + // load extrafields + $line->fetch_optionals(); + } + // Reset fk_parent_line for no child products and special product if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { $fk_parent_line = 0; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0c48a4336d4..5a3f9cb0048 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -557,6 +557,15 @@ class Facture extends CommonInvoice } $newinvoiceline->fk_parent_line=$fk_parent_line; + + if($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except){ + $discount = new DiscountAbsolute($this->db); + $discount->fetch($newinvoiceline->fk_remise_except); + + $discountId = $soc->set_remise_except($discount->amount_ht, $user, $discount->description, $discount->tva_tx); + $newinvoiceline->fk_remise_except = $discountId; + } + $result=$newinvoiceline->insert(); // Defined the new fk_parent_line diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 9d7ae9d0998..e0517ac864c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -457,7 +457,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); } @@ -475,7 +475,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); return img_picto($langs->trans('BillStatusStarted'),'statut3'); } @@ -493,7 +493,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); } @@ -512,7 +512,7 @@ abstract class CommonInvoice extends CommonObject { if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); if ($alreadypaid <= 0) { if ($type == self::TYPE_CREDIT_NOTE) return ''.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' '.img_picto($langs->trans('StatusNotRefunded'),'statut1'); diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 27d57d3e48a..aa392489987 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -201,18 +201,12 @@ if ($permission) { if ($tab[$i]['source']=='internal') { - $userstatic->id=$tab[$i]['id']; - $userstatic->lastname=$tab[$i]['lastname']; - $userstatic->firstname=$tab[$i]['firstname']; - $userstatic->photo=$tab[$i]['photo']; - $userstatic->login=$tab[$i]['login']; + $userstatic->fetch($tab[$i]['id']); echo $userstatic->getNomUrl(-1); } if ($tab[$i]['source']=='external') { - $contactstatic->id=$tab[$i]['id']; - $contactstatic->lastname=$tab[$i]['lastname']; - $contactstatic->firstname=$tab[$i]['firstname']; + $contactstatic->fetch($tab[$i]['id']); echo $contactstatic->getNomUrl(1); } ?> @@ -223,16 +217,10 @@ if ($permission) { id=$tab[$i]['id']; - $userstatic->lastname=$tab[$i]['lastname']; - $userstatic->firstname=$tab[$i]['firstname']; echo $userstatic->LibStatut($tab[$i]['statuscontact'],3); } if ($tab[$i]['source']=='external') { - $contactstatic->id=$tab[$i]['id']; - $contactstatic->lastname=$tab[$i]['lastname']; - $contactstatic->firstname=$tab[$i]['firstname']; echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3); } ?> diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 8e540c799fe..8c97bc4e2c8 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -557,7 +557,7 @@ else dol_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron'); - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; $morehtmlref.='
'; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 74be91ec1ab..1debc47e776 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -805,6 +805,69 @@ class Cronjob extends CommonObject $this->libname = ''; } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("CronJob") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowCronJob"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + return $result; + } + + /** * Load object information * diff --git a/htdocs/cron/info.php b/htdocs/cron/info.php index d3365abb90b..18bfde73bde 100644 --- a/htdocs/cron/info.php +++ b/htdocs/cron/info.php @@ -50,7 +50,7 @@ $head = cron_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CronTask"), -1, 'cron'); -$linkback = '' . $langs->trans("BackToList") . ''; +$linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; $morehtmlref.='
'; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 3933a30a54b..ca21a40635a 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -38,6 +38,7 @@ if (!$user->rights->cron->read) accessforbidden(); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $id=GETPOST('id','int'); +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'cronjoblist'; // To manage different context of search $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -50,9 +51,6 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='t.status'; if (! $sortorder) $sortorder='ASC'; -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$contextpage='cronjoblist'; - $status=GETPOST('status','int'); if ($status == '') $status=-2; @@ -151,6 +149,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex */ $form = new Form($db); +$cronjob = new Cronjob($db); $pagetitle=$langs->trans("CronList"); @@ -280,6 +279,9 @@ if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) $text.=$langs->trans("Warn print info_admin($text); print '
'; +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +//$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; print ''; @@ -340,19 +342,22 @@ if ($num > 0) if (empty($obj)) break; if (! verifCond($obj->test)) continue; // Discard line with test = false + $object->id = $obj->rowid; + $object->ref = $obj->rowid; + $object->label = $obj->label; + print ''; print ''; print '
'; - print ''; - print img_picto('', 'object_cron').' '; - print $obj->rowid; - print ''; + print $object->getNomUrl(1); print ''; if (! empty($obj->label)) { - print ''.$langs->trans($obj->label).''; + $object->ref = $obj->label; + print $object->getNomUrl(0, '', 1); + $object->ref = $obj->rowid; } else { @@ -430,7 +435,7 @@ if ($num > 0) print ''; if ($user->rights->cron->create) { - print "rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"])."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."  "; + print "rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."  "; } if ($user->rights->cron->delete) { diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index e626f950a2b..ce985b51738 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -282,8 +282,8 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights- $canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all)); - // If this is a rough draft - if ($object->statut == 1 || $object->statut == 3) + // If this is a rough draft, approved, canceled or refused + if ($object->statut == 1 || $object->statut == 4 || $object->statut == 5) { // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer if ($canedit) @@ -1255,7 +1255,7 @@ else { print ''.$langs->trans("Validate").''; } - if ($user->rights->holiday->delete && $object->statut == 1) // If draft + if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)) // If draft or canceled or refused { print ''.$langs->trans("DeleteCP").''; } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index b4440700be7..a7d4789468e 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -118,7 +118,7 @@ if (empty($reshook)) $userValue = $_POST['nb_holiday_'.$val['rowid']]; $userValue = $userValue[$userID]; - if (!empty($userValue)) + if (!empty($userValue) || (string) $userValue == '0') { $userValue = price2num($userValue,5); } else { @@ -174,11 +174,14 @@ $userstatic=new User($db); llxHeader('', $langs->trans('CPTitreMenu')); +$typeleaves=$holiday->getTypes(1,1); + + print '
'; if ($optioncss != '') print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -223,10 +226,8 @@ if (is_numeric($listUsers) && $listUsers < 0) setEventMessages($holiday->error, $holiday->errors, 'errors'); } -$var=true; $i = 0; -$typeleaves=$holiday->getTypes(1,1); if (count($typeleaves) == 0) { @@ -240,8 +241,6 @@ else $canedit=0; if (! empty($user->rights->holiday->define_holiday)) $canedit=1; - print ''; - $moreforfilter=''; print '
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 91a503ba6a6..02c44ebee88 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1766,6 +1766,8 @@ MAIN_PDF_MARGIN_LEFT=Left margin on PDF MAIN_PDF_MARGIN_RIGHT=Right margin on PDF MAIN_PDF_MARGIN_TOP=Top margin on PDF MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF +SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups +EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2') ##### Resource #### ResourceSetup=Configuration du module Resource UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).