diff --git a/ChangeLog b/ChangeLog index 7f1d6f41de5..a7a643e9d05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,33 @@ check you make a fetch on object before calling the delete. It was not commonly used and usage generates some problems (cost price for margin calculation not entered, vat setting). Set constant PRODUCT_ADD_FORM_ADD_TO to retrieve it. + + +***** ChangeLog for 4.0.1 compared to 4.0.0 ***** +FIX #2853 +FIX #2991 +FIX #3128 +FIX: #5699 +FIX #5734 +FIX : #5776 +FIX alignement of intervention status +FIX Clean of search fields +FIX Creation of donation should go back on card after creation +FIX Date visible on project overview +FIX Execute a dedicated job from its id may results of launching other jobs too. +FIX: Failed to export contact categories with contact extra fields +FIX inversion customer/supplier price +FIX link "back to list" was not visible. +FIX Lost filter on opportunities +FIX Mandatory field payment term was not css highlighted. +FIX Menu users not visible on dolidroid. +FIX SEC for HTB23302 +FIX The email test sender in email setup was broken +FIX Translation of "Name" is not a good choice for floow-up. +FIX Update of maxnbrun on job list failed. +FIX Value of payment term and project are not set on correct default value when invoice generated from template. +FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15) + ***** ChangeLog for 4.0.0 compared to 3.9.* ***** For users: NEW: Add recurring invoice feature and automatic generation of invoices. diff --git a/build/generate_filecheck_xml.php b/build/generate_filelist_xml.php similarity index 85% rename from build/generate_filecheck_xml.php rename to build/generate_filelist_xml.php index 665bb3a65d1..1bc0e2b6620 100644 --- a/build/generate_filecheck_xml.php +++ b/build/generate_filelist_xml.php @@ -32,11 +32,33 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } +require_once($path."../htdocs/master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); -// Main + +/* + * Main + */ + +if (empty($argv[1])) +{ + print "Usage: ".$script_file." release=x.y.z\n"; + exit -1; +} parse_str($argv[1]); + +if ($release != DOL_VERSION) +{ + print 'Error: release is not version declared into filefunc.in.php.'."\n"; + exit -1; +} + //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; -$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml'; +$outputdir=dirname(__FILE__).'/../htdocs/install'; +print 'Delete current files '.$outputdir.'/filelist*.xml'."\n"; +dol_delete_file($outputdir.'/filelist*.xml',0,1,1); + +$outputfile=$outputdir.'/filelist-'.$release.'.xml'; $fp = fopen($outputfile,'w'); fputs($fp, ''."\n"); fputs($fp, ''."\n"); diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index ac735c59e0d..1883f1814da 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -317,8 +317,13 @@ print "\n"; if ($CHOOSEDTARGET{'-CHKSUM'}) { print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filecheck_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n"; - $ret=`php $SOURCE/build/generate_filecheck_xml.php release=$MAJOR.$MINOR.$BUILD`; + $ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`; print $ret."\n"; + # Copy to final dir + $NEWDESTI=$DESTI; + print "Copy \"$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml\" to $NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml\n"; + use File::Copy qw(copy); + copy "$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml", "$NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"; } @@ -1132,6 +1137,7 @@ if ($nboftargetok) { print "\nList of files to publish (BUILD=$BUILD)\n"; %filestoscansf=( + "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', @@ -1140,6 +1146,7 @@ if ($nboftargetok) { "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' ); %filestoscanstableasso=( + "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu', diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 6ce8bb5fad0..934e5f1f081 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -43,13 +43,13 @@ $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel'); // Security check -if (! $user->admin) - accessforbidden(); + $object = new AccountingAccount($db); // Action -if ($action == 'add') { +if ($action == 'add' && $user->rights->accounting->chartofaccount) +{ if (! $cancel) { $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; @@ -97,7 +97,7 @@ if ($action == 'add') { } header("Location: account.php"); exit; -} else if ($action == 'edit') { +} else if ($action == 'edit' && $user->rights->accounting->chartofaccount) { if (! $cancel) { $result = $object->fetch($id); @@ -145,7 +145,7 @@ if ($action == 'add') { header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit(); } -} else if ($action == 'delete') { +} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) { $result = $object->fetch($id); if (! empty($object->id)) { @@ -329,14 +329,14 @@ if ($action == 'create') { print '' . $object->pcg_subtype . ''; // Active - print '' . $langs->trans("Activated") . ''; + print '' . $langs->trans("Status") . ''; print ''; - - if (empty($object->active)) { + print $object->getLibStatut(4); + /*if (empty($object->active)) { print img_picto($langs->trans("Disabled"), 'switch_off'); } else { print img_picto($langs->trans("Activated"), 'switch_on'); - } + }*/ print ''; @@ -350,13 +350,13 @@ if ($action == 'create') { print '
'; - if ($user->admin) { + if (! empty($user->rights->accounting->chartofaccount)) { print '' . $langs->trans('Modify') . ''; } else { print '' . $langs->trans('Modify') . ''; } - if ($user->admin) { + if (! empty($user->rights->accounting->chartofaccount)) { print '' . $langs->trans('Delete') . ''; } else { print '' . $langs->trans('Delete') . ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 736581e9248..7fef6dfa8fb 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -65,7 +65,7 @@ $formventilation = new FormVentilation($db); $formother = new FormOther($db); $form = new Form($db); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_accountancy_code_start = ''; $search_accountancy_code_end = ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index e5d8aeb6f17..17bbe55158c 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -276,7 +276,7 @@ if ($result < 0) { } if ($action == 'delmouv') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); print $formconfirm; } if ($action == 'delbookkeepingyear') { diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 690f3785df1..00a16a227e3 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -45,7 +45,8 @@ class AccountingAccount extends CommonObject var $label; var $fk_user_author; var $fk_user_modif; - var $active; + var $active; // duplicate with status + var $status; /** * Constructor @@ -103,6 +104,7 @@ class AccountingAccount extends CommonObject $this->fk_user_author = $obj->fk_user_author; $this->fk_user_modif = $obj->fk_user_modif; $this->active = $obj->active; + $this->status = $obj->active; return $this->id; } else { @@ -465,4 +467,61 @@ class AccountingAccount extends CommonObject return - 1; } } + + + /** + * Retourne le libelle du statut d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function LibStatut($statut,$mode=0) + { + global $langs; + $langs->load('users'); + + if ($mode == 0) + { + $prefix=''; + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } } diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index f94ec8a2b0f..237c0def27f 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -65,17 +65,16 @@ class FormVentilation extends Form /** * Return list of accounts with label by chart of accounts * - * @param string $selectid Preselected chart of accounts - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param array $event Event options - * @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1) - * @param int $select_out set value returned by select 0=rowid (default), 1=account_number - * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number - * + * @param string $selectid Preselected chart of accounts + * @param string $htmlname Name of field in html form + * @param int $showempty Add an empty field + * @param array $event Event options + * @param int $select_in selectid value is a aa.rowid (0 default) or aa.account_number (1) + * @param int $select_out set value returned by select 0=rowid (default), 1=account_number + * @param string $morecss More css non HTML object * @return string String with HTML select */ - function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone') { global $conf; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -126,7 +125,7 @@ class FormVentilation extends Form $options[$select_value_out] = $label; } - $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); + $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss); $this->db->free($resql); return $out; } @@ -322,15 +321,15 @@ class FormVentilation extends Form /** * Return HTML combo list of years existing into book keepping * - * @param string $selected Preselected value - * @param string $htmlname Name of HTML select object - * @param int $useempty Affiche valeur vide dans liste - * @param string $output_format (html/opton (for option html only)/array (to return options arrays + * @param string $selected Preselected value + * @param string $htmlname Name of HTML select object + * @param int $useempty Affiche valeur vide dans liste + * @param string $output_format Html/option (for option html only)/array (to return options arrays * @return string/array */ function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html') { - global $conf; + global $conf,$langs; $out_array = array(); @@ -349,7 +348,7 @@ class FormVentilation extends Form return -1; } while ($obj = $this->db->fetch_object($resql)) { - $out_array[$obj->code_journal] = $obj->code_journal; + $out_array[$obj->code_journal] = $obj->code_journal?$obj->code_journal:$langs->trans("NotDefined"); // TODO Not defined is accepted ? We should avoid this, shouldn't we ? } $this->db->free($resql); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 18a18720569..be23efb56ea 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -85,7 +85,7 @@ if ($action == 'validatehistory') { setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); - setEventMessages($langs->trans('Dispatched'), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } } elseif ($action == 'fixaccountancycode') { $error = 0; @@ -133,9 +133,11 @@ if ($action == 'validatehistory') { } } + /* * View */ + llxHeader('', $langs->trans("CustomersVentilation")); $textprevyear = '' . img_previous() . ''; @@ -143,11 +145,14 @@ $textnextyear = ' ' . $langs->trans("DescVentilCustomer") . ''; +print $langs->trans("DescVentilCustomer") . '
'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToDispatch")) . '
'; +print '
'; print '
'; $sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 31e4ea7ccff..a579daf1a9d 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -263,7 +263,7 @@ if ($result) { print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("IntracommunityVATNumber"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ventilate") . '
/', '', '', '', '', 'align="center"'); print "\n"; @@ -272,11 +272,11 @@ if ($result) { print ''; print ''; print ''; - print ''; - print '%'; + print ''; + print '%'; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print "\n"; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 674edd94e86..2506267ac15 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -81,7 +81,7 @@ if ($action == 'validatehistory') { setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); - setEventMessages($langs->trans('Dispatched'), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } } elseif ($action == 'fixaccountancycode') { $error = 0; @@ -140,11 +140,15 @@ $textnextyear = ' ' . $langs->trans("DescVentilSupplier") . ''; +print $langs->trans("DescVentilSupplier") . '
'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToDispatch")) . '
'; +print '
'; + print '
'; $y = $year_current; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 18b1c4b6b74..bbb76f7c15c 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -223,9 +223,9 @@ if ($result) { print ''; print ''; print ''; - print ''; - print '%'; - print ''; + print ''; + print '%'; + print ''; print ' '; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 9713983d45a..fbe0a471e3d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1238,6 +1238,7 @@ if ($id) { foreach ($fieldlist as $field => $value) { + $showfield=1; $align="left"; $valuetoshow=$obj->{$fieldlist[$field]}; @@ -1374,20 +1375,18 @@ if ($id) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; - $align="center"; + $align="right"; } else if ($fieldlist[$field]=='localtax2_type') { if ($obj->localtax2 != 0) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; - $align="center"; + $align="right"; } else if ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax1 == 0) - $valuetoshow = ''; - $align="right"; + $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) { @@ -1567,7 +1566,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } // For state page, we do not show the country input (we link to region, not country) print ''; $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth300'); + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; } elseif ($fieldlist[$field] == 'country_id') @@ -1689,7 +1688,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') if (! empty($conf->accounting->enabled)) { $accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1); + print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } else { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f4387ebb71a..9c5ac5e40cb 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -929,7 +929,7 @@ class Propal extends CommonObject for ($i=0;$i<$num;$i++) { - // Reset fk_parent_line for no child products and special product + // Reset fk_parent_line for line that are not child lines or special product if (($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line)) || $this->lines[$i]->product_type == 9) { $fk_parent_line = 0; } @@ -945,7 +945,7 @@ class Propal extends CommonObject $this->lines[$i]->remise_percent, 'HT', 0, - 0, + $this->lines[$i]->info_bits, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, @@ -1161,6 +1161,7 @@ class Propal extends CommonObject $clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj); // Create clone + $result=$clonedObj->create($user); if ($result < 0) $error++; else @@ -3635,7 +3636,11 @@ class PropaleLigne extends CommonObjectLine if (empty($this->fk_fournprice)) $this->fk_fournprice=0; if (! is_numeric($this->qty)) $this->qty = 0; if (empty($this->pa_ht)) $this->pa_ht=0; - + if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0; + if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; + if (empty($this->multicurrency_total_vat)) $this->multicurrency_total_vat=0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; + // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0 && $pa_ht_isemptystring) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 67a671a4bf9..3f1f440ce31 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1599,7 +1599,14 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; - print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) + { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + } + print $form->select_incoterms($incoterm_id, $incoterm_location); print ''; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 224fa892a87..25a19868a45 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -279,7 +279,7 @@ class Commande extends CommonOrder if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) { - $this->error='ErrorPermissionDenied'; + $this->error='NotEnoughPermissions'; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 0c0eed06783..b2f1edc15c3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2435,7 +2435,14 @@ if ($action == 'create') print ''; print ''; print ''; - print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) + { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + } + print $form->select_incoterms($incoterm_id, $incoterm_location); print ''; } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 563ec168d29..03f7e39bde8 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1105,12 +1105,12 @@ class CMailFile $_retVal = true; // Indicates if Object was created or not $server_response = ''; - while ( substr($server_response,3,1) != ' ' ) + while (substr($server_response,3,1) != ' ') { - if( !( $server_response = fgets($socket, 256) ) ) + if (! ($server_response = fgets($socket, 256)) ) { $this->error="Couldn't get mail server response codes"; - $_retVal = false; + return false; } } diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index b8eae83d4eb..655e10afd67 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -85,7 +85,7 @@ if (! class_exists('MenuManager')) } $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); $menumanager->loadMenu('all','all'); - +//var_dump($menumanager->tabMenu);exit; $menumanager->showmenu('jmobile'); print ''; diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index 64a4c5ef031..aade8149ce5 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -100,10 +100,12 @@ function dol_print_cron_urls() print img_picto('','object_globe.png').' '.$url."
\n"; print '
'; - + $logintouse = 'firstadmin'; + if ($user->admin) $logintouse = $user->login; + print ''.$langs->trans("FileToLaunchCronJobs").':
'; - $file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$user->login.' [cronjobid]'; + $file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; print '
\n"; print '
'; @@ -116,7 +118,7 @@ function dol_print_cron_urls() { print $langs->trans("CronExplainHowToRunUnix"); print '
'; - print '
'; + print '
'; } else { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c1436e6d36e..ba60121969b 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -617,7 +617,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable // Security: // Disallow file with some extensions. We renamed them. // Car si on a mis le rep documents dans un rep de la racine web (pas bien), cela permet d'executer du code a la demande. - if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$dest_file)) + if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) { $file_name.= '.noexe'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b330145c849..e98dd142e1e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5404,7 +5404,7 @@ function printCommonFooter($zone='private') print ''."\n"; print "page_y=getParameterByName('page_y', 0);"; - print "if (page_y > 0) $('html, body').scrollTop(page_y);"; + print "if (page_y > 0) $('html, body').scrollTop(page_y);\n"; print ''."\n"; print 'jQuery(".reposition").click(function() { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5fa1f56eb38..d486b60b6bd 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -434,7 +434,8 @@ function print_end_menu_array() /** * Core function to output left menu eldy - * + * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) + * * @param DoliDB $db Database handler * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) @@ -442,7 +443,7 @@ function print_end_menu_array() * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' - * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not efined in session. * @param array $moredata An array with more data to output * @return int nb of menu entries */ @@ -586,7 +587,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users'); if ($user->rights->user->user->lire) { - if (! empty($leftmenu) && $leftmenu=="users") + if (empty($leftmenu) || $leftmenu=="users") { $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home'); @@ -597,6 +598,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin); } } + } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 5800e4b5d7a..db1a7b8392f 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -105,6 +105,8 @@ class MenuManager $menuArbo = new Menubase($this->db,'eldy'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu); $this->tabMenu=$tabMenu; + + //if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; } } @@ -150,8 +152,9 @@ class MenuManager if ($mode == 'jmobile') { - print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); + print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); // Fill this->menu that is empty with top menu + print ''."\n"; foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { @@ -169,8 +172,9 @@ class MenuManager $tmpmainmenu=$val['mainmenu']; $tmpleftmenu='all'; $submenu=new Menu(); - print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); - $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home) + //if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu);exit; } + $nexturl=dol_buildpath($submenu->liste[0]['url'],1); $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); @@ -194,6 +198,7 @@ class MenuManager print ''; print ''."\n"; } + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'] { $showmenu=true; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index f20c46893c6..0c57cf644bc 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -338,11 +338,6 @@ class pdf_crabe extends ModelePDFFactures $height_incoterms = 0; if ($conf->incoterm->enabled) { - if (is_object($object->thirdparty)) - { - $object->fk_incoterms=$object->thirdparty->fk_incoterms; - $object->location_incoterms=$object->thirdparty->location_incoterms; - } $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index adcaa9d7f00..42a660ab0ae 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -121,7 +121,14 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); + if (is_object($langs)) // $langs may not be defined yet. + { + $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); + } + else + { + $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; + } } return $errors; @@ -151,7 +158,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface $res = @include_once('ChromePhp.php'); if (! $res) $res=@include_once('ChromePhp.class.php'); set_include_path($oldinclude); - + ob_start(); // To be sure headers are not flushed until all page is completely processed if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 5ef1444ec19..d30fdd09407 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -36,6 +36,8 @@ var unique = jQuery("#unique"); var required = jQuery("#required"); var default_value = jQuery("#default_value"); + var alwayseditable = jQuery("#alwayseditable"); + var list = jQuery("#list"); - if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'select') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'link') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} - else if (type == 'sellist') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'radio') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} - else if (type == 'separate') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else {size.val('').prop('disabled', true);required.removeAttr('disabled');default_value.removeAttr('disabled');} + else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled'); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'select') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'link') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} + else if (type == 'sellist') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'radio') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.removeAttr('disabled');default_value.removeAttr('disabled');jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} + else if (type == 'separate') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else { size.val('').prop('disabled', true); required.removeAttr('disabled'); default_value.removeAttr('disabled'); } + + if (type == 'separate') + { + alwayseditable.val('').prop('disabled', true); list.val('').prop('disabled', true); + } + else + { + alwayseditable.val('').removeAttr('disabled'); list.val('').removeAttr('disabled'); + } } init_typeoffields(''); jQuery("#type").change(function() { @@ -81,7 +92,7 @@ - + diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 9f894095807..94132731829 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -27,6 +27,8 @@ var unique = jQuery("#unique"); var required = jQuery("#required"); var default_value = jQuery("#default_value"); + var alwayseditable = jQuery("#alwayseditable"); + var list = jQuery("#list"); - + diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 068fbc753cb..9669fe89e54 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -724,7 +724,7 @@ INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES ( INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (3,'PROPO' ,'Proposal', 30, 40,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (4,'NEGO' ,'Negotiation', 40, 60,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (5,'PENDING','Pending', 50, 50,0); -INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WIN' ,'Won', 60, 100,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WON' ,'Won', 60, 100,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1); diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 9e1fe249834..c015f2aa929 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -399,8 +399,8 @@ INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE',"Marge commerciale", '', 0, 1, '1 + 2', '30', 1, 1); UPDATE llx_accounting_account SET account_parent = '0' WHERE account_parent = ''; --- VMYSQL4.1 ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0; --- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_parent TYPE integer USING account_parent::integer; +-- VMYSQL4.1 ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent varchar(32) DEFAULT '0'; +-- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_parent SET DEFAULT '0'; CREATE TABLE llx_accounting_journal ( diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql index 1d85db2cc48..316aeca2069 100644 --- a/htdocs/install/mysql/tables/llx_accounting_account.sql +++ b/htdocs/install/mysql/tables/llx_accounting_account.sql @@ -29,7 +29,7 @@ create table llx_accounting_account pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, account_number varchar(32) NOT NULL, - account_parent varchar(32) DEFAULT '', -- Hierarchic parent + account_parent varchar(32) DEFAULT '0', -- Hierarchic parent label varchar(255) NOT NULL, fk_accounting_category integer DEFAULT 0, fk_user_author integer DEFAULT NULL, diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 79f20e2bf40..f3571d14ea7 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -29,7 +29,7 @@ NewAccount=New accounting account Create=Create CreateMvts=Create movement UpdateMvts=Modification of a movement -WriteBookKeeping=Record accounts in general ledger +WriteBookKeeping=Write records in general ledger Bookkeeping=General ledger AccountBalance=Account balance @@ -89,7 +89,8 @@ NotMatch=Not Set DeleteMvt=Delete general ledger lines DelYear=Year to delete DelJournal=Journal to delete -ConfirmDeleteMvt=This will delete all line of of the general ledger for year and/or from a specifics journal +ConfirmDeleteMvt=This will delete all lines of the general ledger for year and/or from a specifics journal +ConfirmDeleteMvtPartial=This will delete the selected line(s) of the general ledger DelBookKeeping=Delete the records of the general ledger @@ -116,17 +117,20 @@ Pcgtype=Class of account Pcgsubtype=Under class of account Accountparent=Root of the account -DescVentilCustomer=Consult here the annual breakdown accounting of your invoices customers TotalVente=Total turnover before tax TotalMarge=Total sales margin -DescVentilDoneCustomer=Consult here the list of the lines of invoices customers and their accounting account -DescVentilTodoCustomer=Ventilate your lines of customer invoice with an accounting account + +DescVentilCustomer=Consult here the list of customer invoice lines binded (or not) to a product bookkeeping account +DescVentilMore=In most cases, if you use predefined products or services and you set the account number on the product/service card, the application will be able to make all the binding between your invoice lines and the bookkeeping account of your chart of accounts, just in one click with the button "%s". If account was not set on product/service cards or if you still has some lines not binded to any account, you will have to make a manual binding from the menu "%s". +DescVentilDoneCustomer=Consult here the list of the lines of invoices customers and their product bookkeeping account +DescVentilTodoCustomer=Bind your lines of customer invoice with a product bookkeeping account ChangeAccount=Change the accounting account for lines selected by the account: Vide=- -DescVentilSupplier=Consult here the annual breakdown accounting of your invoices suppliers -DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their accounting account +DescVentilSupplier=Consult here the list of supplier invoice lines binded or not yet binded to a product bookkeeping account +DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their bookkeeping account -ValidateHistory=Validate Automatically +ValidateHistory=Bind Automatically +AutomaticBindingDone=Automatic binding done ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s @@ -160,7 +164,7 @@ OptionModeProductBuy=Mode purchases OptionModeProductSellDesc=Show all products with no accounting account defined for sales. OptionModeProductBuyDesc=Show all products with no accounting account defined for purchases. CleanFixHistory=Remove accountancy code from lines that not exists into charts of account -CleanHistory=Reset all accountancy for selected year +CleanHistory=Reset all bindings for selected year ## Dictionary Range=Range of accounting account @@ -171,3 +175,8 @@ Formula=Formula ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country ExportNotSupported=The export format setuped is not supported into this page BookeppingLineAlreayExists=Lines already existing into bookeeping + + +Binded=Lines binded +To bind=Lines to bind + diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1128bcd4a66..568d7edf1de 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -195,6 +195,8 @@ class Product extends CommonObject var $buyprice; public $fourn_pu; + public $fourn_price_base_type; + /** * @deprecated * @see ref_supplier @@ -1321,7 +1323,7 @@ class Product extends CommonObject * This also set some properties on product like ->buyprice, ->fourn_pu, ... * * @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price - * @param double $qty Quantity asked + * @param double $qty Quantity asked or -1 to get first entry found * @param int $product_id Filter on a particular product id * @param string $fourn_ref Filter on a supplier ref. 'none' to exclude ref in search. * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) @@ -1344,7 +1346,7 @@ class Product extends CommonObject if ($resql) { $obj = $this->db->fetch_object($resql); - if ($obj && $obj->quantity > 0) // If found + if ($obj && $obj->quantity > 0) // If we found a supplier prices from the id of supplier price { if (!empty($conf->dynamicprices->enabled) && !empty($obj->fk_supplier_price_expression)) { @@ -1362,7 +1364,8 @@ class Product extends CommonObject } } $this->buyprice = $obj->price; // deprecated - $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id + $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier + $this->fourn_price_base_type = 'HT'; // Price base type $this->ref_fourn = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier @@ -1404,8 +1407,9 @@ class Product extends CommonObject } } $this->buyprice = $obj->price; // deprecated - $this->fourn_qty = $obj->quantity; // min quantity for price - $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id + $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier + $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier + $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier $this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 0e7333708f1..d14645e5e99 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -770,7 +770,7 @@ class Project extends CommonObject if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - // TODO What to do if fk_opp_status is not code 'WIN' or 'LOST' + // TODO What to do if fk_opp_status is not code 'WON' or 'LOST' } dol_syslog(get_class($this)."::setClose", LOG_DEBUG); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6bf03741732..fb29e4089cc 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -215,7 +215,7 @@ $sql.= ", cls.code as opp_status_code"; // We'll need these fields in order to filter by categ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; // Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook @@ -275,7 +275,7 @@ if ($search_opp_status) { if (is_numeric($search_opp_status) && $search_opp_status > 0) $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status); if ($search_opp_status == 'all') $sql .= " AND p.fk_opp_status IS NOT NULL"; - if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WIN','LOST'))"; + if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST'))"; if ($search_opp_status == 'none') $sql .= " AND p.fk_opp_status IS NULL"; } if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); @@ -336,8 +336,8 @@ if ($resql) if ($search_label != '') $param.='&search_label='.$search_label; if ($search_societe != '') $param.='&search_societe='.$search_societe; if ($search_status >= 0) $param.='&search_status='.$search_status; - if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); - if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); + if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); + if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','openedopp','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); if ($search_public != '') $param.='&search_public='.$search_public; if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 55b286047d9..0dd08bbd342 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -92,8 +92,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $object->description = $_POST['description']; $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; - $object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); - $object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user'); + $object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); + $object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']); $object->progress = $_POST['progress']; // Fill array 'array_options' with data from add form diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 2f3d7e7201c..3cec12bac7d 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -586,7 +586,8 @@ if (empty($reshook)) if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg)) { $idprod=$reg[1]; - // Call to init properties of $productsupplier + $res=$productsupplier->fetch($idprod); + // Call to init properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist } @@ -594,37 +595,35 @@ if (empty($reshook)) { //$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist + $res=$productsupplier->fetch($idprod); } - if ($idprod > 0) { - $res=$productsupplier->fetch($idprod); - + $pu_ht = $productsupplier->fourn_pu; + $price_base_type = $productsupplier->fourn_price_base_type; + $type = $productsupplier->type; $label = $productsupplier->label; - $desc = $productsupplier->description; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); - $type = $productsupplier->type; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); - + $result=$object->addline( $desc, - $productsupplier->fourn_pu, + $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $productsupplier->id, $remise_percent, - $type, - $productsupplier->price_ttc, + $price_base_type, + $pu_ttc, $tva_npr, $type, -1, @@ -636,6 +635,7 @@ if (empty($reshook)) $array_options, $ref_fourn ); + //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; } if ($idprod == -99 || $idprod == 0) { diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 1d27f03cff9..e10d089c2a8 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -157,7 +157,8 @@ if(is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error cronjob->fetch: ".$cronjob->error; + echo "Error cronjob->fetch: ".$cronjob->error."\n"; + echo "Failed to fetch job ".$line->id."\n"; dol_syslog("cron_run_jobs.php::fetch Error ".$cronjob->error, LOG_ERR); exit(-1); } @@ -165,7 +166,9 @@ if(is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->run_jobs($userlogin); if ($result<0) { - echo "Error cronjob->run_job: ".$cronjob->error; + echo "Error cronjob->run_job: ".$cronjob->error."\n"; + echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; + echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; dol_syslog("cron_run_jobs.php::run_jobs Error ".$cronjob->error, LOG_ERR); exit(-1); } @@ -174,7 +177,8 @@ if(is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error cronjob->reprogram_job: ".$cronjob->error; + echo "Error cronjob->reprogram_job: ".$cronjob->error."\n"; + echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; dol_syslog("cron_run_jobs.php::reprogram_jobs Error ".$cronjob->error, LOG_ERR); exit(-1); }
trans("Label"); ?>
trans("Label"); ?>
trans("AttributeCode"); ?> (trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>)
trans("Label"); ?>
trans("Label"); ?>
trans("AttributeCode"); ?>