diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index e759e93a635..406d7b5916c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1096,21 +1096,36 @@ class ActionComm extends CommonObject */ function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0) { - global $conf,$langs; + global $conf,$langs, $hookmanager; - $result=''; - $tooltip = '' . $langs->trans('ShowAction'.$objp->code) . ''; - if (! empty($this->ref)) - $tooltip .= '
' . $langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->label)) - $tooltip .= '
' . $langs->trans('Title') . ': ' . $this->label; - $label = $this->label; - if (empty($label)) $label=$this->libelle; // For backward compatibility - $linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'">'; - if ($option=='birthday') $link = ''; + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('actiondao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); + + if ($option=='birthday') + $link = 'libelle.'-'.$withpicto; if ($withpicto == 2) { diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 26be80caa68..e9596149e4f 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -3,6 +3,7 @@ * Copyright (C) 2008-2009 Laurent Destailleur (Eldy) * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2015 Marcos García * * 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 @@ -166,10 +167,12 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Social contributions $sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; + $sql3.= ", cs.fk_account"; $sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; $sql3.= " WHERE cs.entity = ".$conf->entity; $sql3.= " AND cs.paye = 0"; // Not paid + $sql3.= " AND (cs.fk_account IN (0, ".$acct->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution $sql3.= " ORDER BY dlr ASC"; $error=0; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a68f3445305..06a32c3865f 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Frédéric France * * 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 @@ -159,6 +160,8 @@ if ($_GET["action"] == 'create') $charge = new ChargeSociales($db); $charge->fetch($chid); + $charge->accountid=$charge->fk_account?$charge->fk_account:$charge->accountid; + $charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype; $total = $charge->amount; @@ -178,16 +181,16 @@ if ($_GET["action"] == 'create') dol_fiche_head('', ''); - print ''; + print '
'; - print ""; + print ""; - print ''; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print ''; + print ''; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ''; $sql = "SELECT sum(p.amount) as total"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -199,28 +202,28 @@ if ($_GET["action"] == 'create') $sumpaid = $obj->total; $db->free(); } - print ''; - print ''; + print ''; + print ''; print ''; - print "'; + print "'; print ''; - print '"; print ''; - print '\n"; print ''; print ''; print ''; - print ''; @@ -228,11 +231,11 @@ if ($_GET["action"] == 'create') print ''; - print ''."\n"; + print ''."\n"; print ''; print ''; - print ''; + print ''; print ''; print '
".$langs->trans("SocialContribution")."
".$langs->trans("SocialContribution")."
'.$langs->trans("Ref").''.$chid.'
'.$langs->trans("Type")."".$charge->type_libelle."
'.$langs->trans("Period")."".dol_print_date($charge->periode,'day')."
'.$langs->trans("Label").''.$charge->lib."
'.$langs->trans("DateDue")."".dol_print_date($charge->date_ech,'day')."
'.$langs->trans("Amount")."".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("Ref").''.$chid.'
'.$langs->trans("Type")."".$charge->type_libelle."
'.$langs->trans("Period")."".dol_print_date($charge->periode,'day')."
'.$langs->trans("Label").''.$charge->lib."
'.$langs->trans("DateDue")."".dol_print_date($charge->date_ech,'day')."
'.$langs->trans("Amount")."".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("AlreadyPaid").''.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("AlreadyPaid").''.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
".$langs->trans("Payment").'".$langs->trans("Payment").'
'.$langs->trans("Date").''; + print '
'.$langs->trans("Date").''; $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0; $form->select_date($datepayment,'','','','',"add_payment",1,1); print "
'.$langs->trans("PaymentMode").''; + print '
'.$langs->trans("PaymentMode").''; $form->select_types_paiements(isset($_POST["paiementtype"])?$_POST["paiementtype"]:$charge->paiementtype, "paiementtype"); print "
'.$langs->trans('AccountToDebit').''; + print ''; $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list print '
'.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print '
'.$langs->trans("Comments").'
'; diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 6e7c9ad93c2..f5a6cc2f6a9 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2016 Frédéric France * * 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 @@ -71,6 +72,23 @@ if ($action == 'reopen' && $user->rights->tax->charges->creer) { } } +// payment mode +if ($action == 'setmode' && $user->rights->tax->charges->creer) { + $object->fetch($id); + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); +} + +// bank account +if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) { + $object->fetch($id); + $result=$object->setBankAccount(GETPOST('fk_account', 'int')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + // Delete social contribution if ($action == 'confirm_delete' && $confirm == 'yes') { @@ -127,6 +145,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $object->date_ech=$dateech; $object->periode=$dateperiod; $object->amount=$amount; + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); $id=$object->create($user); if ($id <= 0) @@ -290,6 +310,17 @@ if ($action == 'create') print ''; print ''; print ''; + // Payment Mode + print '' . $langs->trans('PaymentMode') . ''; + $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); + print ''; + // Bank Account + if (! empty($conf->banque->enabled)) + { + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } // Date due print ''; print ''; @@ -313,7 +344,7 @@ if ($action == 'create') /* *************************************************************************** */ /* */ -/* Mode fiche */ +/* Card Mode */ /* */ /* *************************************************************************** */ if ($id > 0) @@ -382,7 +413,8 @@ if ($id > 0) // Type print "".$langs->trans("Type")."".$object->type_libelle.""; - $rowspan=5; + $rowspan=6; + if (! empty($conf->banque->enabled)) $rowspan++; print ''; /* @@ -422,8 +454,8 @@ if ($id > 0) print ""; print '
'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; - print "".$labeltype.' '.$objp->num_paiement."\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "".$labeltype.' '.$objp->num_paiement."\n"; print ''.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; print ""; $totalpaye += $objp->amount; @@ -432,12 +464,12 @@ if ($id > 0) if ($object->paye == 0) { - print "".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."\n"; - print "".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; + print "".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."\n"; + print "".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; $resteapayer = $object->amount - $totalpaye; - print "".$langs->trans("RemainderToPay")." :"; + print "".$langs->trans("RemainderToPay")." :"; print "".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."\n"; } print ""; @@ -486,6 +518,42 @@ if ($id > 0) print ''.$langs->trans("AmountTTC").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; } + // Mode of payment + print ''; + print ''; + if ($action != 'editmode') + print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; + print ''; + if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); + } else { + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); + } + print ''; + + // Bank Account + if (! empty($conf->banque->enabled)) + { + print ''; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) + print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print ''; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print ''; + print ''; + } + // Status print ''.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).''; @@ -500,7 +568,7 @@ if ($id > 0) print ''; print '   '; print ''; - print ''; } if ($action == 'edit') print "\n"; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index e5653ba2ee3..af3acbf4c7f 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2016 Frédéric France * * 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 @@ -49,6 +50,7 @@ class ChargeSociales extends CommonObject var $date_creation; var $date_modification; var $date_validation; + var $fk_account; /** @@ -71,13 +73,16 @@ class ChargeSociales extends CommonObject */ function fetch($id, $ref='') { - $sql = "SELECT cs.rowid, cs.date_ech,"; - $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key,"; - $sql.= " c.libelle"; - $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; - $sql.= " WHERE cs.fk_type = c.id"; - if ($ref) $sql.= " AND cs.rowid = ".$ref; - else $sql.= " AND cs.rowid = ".$id; + $sql = "SELECT cs.rowid, cs.date_ech"; + $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key"; + $sql.= ", cs.fk_account, cs.fk_mode_reglement"; + $sql.= ", c.libelle"; + $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; + $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; + if ($ref) $sql.= " WHERE cs.rowid = ".$ref; + else $sql.= " WHERE cs.rowid = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); @@ -93,6 +98,10 @@ class ChargeSociales extends CommonObject $this->lib = $obj->lib; $this->type = $obj->fk_type; $this->type_libelle = $obj->libelle; + $this->fk_account = $obj->fk_account; + $this->mode_reglement_id = $obj->fk_mode_reglement; + $this->mode_reglement_code = $obj->mode_reglement_code; + $this->mode_reglement = $obj->mode_reglement_libelle; $this->amount = $obj->amount; $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->periode); @@ -155,8 +164,11 @@ class ChargeSociales extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount, entity)"; - $sql.= " VALUES (".$this->type.",'".$this->db->escape($this->lib)."',"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity)"; + $sql.= " VALUES (".$this->type; + $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); + $sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL"); + $sql.= ", '".$this->db->escape($this->lib)."',"; $sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',"; $sql.= " '".price2num($newamount)."',"; $sql.= " ".$conf->entity; @@ -216,7 +228,7 @@ class ChargeSociales extends CommonObject // Delete payments if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge='".$this->id."'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge='".$this->id."'"; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) @@ -228,7 +240,7 @@ class ChargeSociales extends CommonObject if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$this->id."'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid='".$this->id."'"; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index b673a5064ed..15ca799c1c2 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2016 Frédéric France * * 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 @@ -255,7 +256,7 @@ if ($resql) // Due date print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; - print ''.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).''; + print ''.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).''; print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 259918c5aa9..78752bdba03 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -957,39 +957,53 @@ class Contact extends CommonObject */ function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') { - global $conf, $langs; + global $conf, $langs, $hookmanager; $result=''; - $label = '' . $langs->trans("ShowContact") . ''; - $label.= '
' . $langs->trans("Name") . ': '.$this->getFullName($langs); - //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code - if (! empty($this->poste)) $label.= '
' . $langs->trans("Poste") . ': '.$this->poste; - $label.= '
' . $langs->trans("EMail") . ': '.$this->email; - $phonelist=array(); - if ($this->phone_pro) $phonelist[]=$this->phone_pro; - if ($this->phone_mobile) $phonelist[]=$this->phone_mobile; - if ($this->phone_perso) $phonelist[]=$this->phone_perso; - $label.= '
' . $langs->trans("Phone") . ': '.join(', ',$phonelist); - $label.= '
' . $langs->trans("Address") . ': '.dol_format_address($this, 1, ' ', $langs); + $label = '' . $langs->trans("ShowContact") . ''; + $label.= '
' . $langs->trans("Name") . ': '.$this->getFullName($langs); + //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code + if (! empty($this->poste)) $label.= '
' . $langs->trans("Poste") . ': '.$this->poste; + $label.= '
' . $langs->trans("EMail") . ': '.$this->email; + $phonelist=array(); + if ($this->phone_pro) $phonelist[]=$this->phone_pro; + if ($this->phone_mobile) $phonelist[]=$this->phone_mobile; + if ($this->phone_perso) $phonelist[]=$this->phone_perso; + $label.= '
' . $langs->trans("Phone") . ': '.join(', ',$phonelist); + $label.= '
' . $langs->trans("Address") . ': '.dol_format_address($this, 1, ' ', $langs); + + $link = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowContact"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.= ' class="classfortooltip">'; - $link = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowContact"); - $link.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $link.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $link.= ' class="classfortooltip">'; + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('contactdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + + $link.=$linkclose; + $linkend=''; - + if ($option == 'xxx') { $link = ''; $linkend=''; } - - if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' '); - $result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend; + + if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' '); + $result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend; return $result; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 03b64113ac1..1549a2603b6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -619,54 +619,52 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename=' // If syslog module enabled if (empty($conf->syslog->enabled)) return; - if (! empty($level)) + // Test log level + $logLevels = array(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG); + if (!in_array($level, $logLevels, true)) { - // Test log level - $logLevels = array( LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG); - if (!in_array($level, $logLevels)) - { - throw new Exception('Incorrect log level'); - } - if ($level > $conf->global->SYSLOG_LEVEL) return; - - // If adding log inside HTML page is required - if (! empty($_REQUEST['logtohtml']) && (! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || ! empty($conf->global->MAIN_LOGTOHTML))) // MAIN_LOGTOHTML kept for backward compatibility - { - $conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message; - } - - //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output - // If enable html log tag enabled and url parameter log defined, we show output log on HTML comments - if (! empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && ! empty($_GET["log"])) - { - print "\n\n\n"; - } - - $data = array( - 'message' => $message, - 'script' => (isset($_SERVER['PHP_SELF'])? basename($_SERVER['PHP_SELF'],'.php') : false), - 'level' => $level, - 'user' => ((is_object($user) && $user->id) ? $user->login : false), - 'ip' => false - ); - - if (! empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR']; - // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) - else if (! empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR']; - // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). - else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']); - // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). - else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME']; - // Loop on each log handler and send output - foreach ($conf->loghandlers as $loghandlerinstance) - { - if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) continue; - $loghandlerinstance->export($data,$suffixinfilename); - } - unset($data); + throw new Exception('Incorrect log level'); } + if ($level > $conf->global->SYSLOG_LEVEL) return; + + // If adding log inside HTML page is required + if (! empty($_REQUEST['logtohtml']) && (! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || ! empty($conf->global->MAIN_LOGTOHTML))) // MAIN_LOGTOHTML kept for backward compatibility + { + $conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message; + } + + //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output + // If enable html log tag enabled and url parameter log defined, we show output log on HTML comments + if (! empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && ! empty($_GET["log"])) + { + print "\n\n\n"; + } + + $data = array( + 'message' => $message, + 'script' => (isset($_SERVER['PHP_SELF'])? basename($_SERVER['PHP_SELF'],'.php') : false), + 'level' => $level, + 'user' => ((is_object($user) && $user->id) ? $user->login : false), + 'ip' => false + ); + + if (! empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR']; + // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) + else if (! empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR']; + // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). + else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']); + // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). + else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME']; + // Loop on each log handler and send output + foreach ($conf->loghandlers as $loghandlerinstance) + { + if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) continue; + $loghandlerinstance->export($data,$suffixinfilename); + } + unset($data); + if (! empty($ident)) { diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index b94a41e1d12..2d61e76d524 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -72,6 +72,18 @@ class pdf_rouget extends ModelePdfExpedition $this->posxweightvol=$this->page_largeur - $this->marge_droite - 76; $this->posxqtyordered=$this->page_largeur - $this->marge_droite - 56; $this->posxqtytoship=$this->page_largeur - $this->marge_droite - 28; + $this->posxpuht=$this->page_largeur - $this->marge_droite; + + if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) { + + $this->posxweightvol=$this->page_largeur - $this->marge_droite - 130; + $this->posxqtyordered=$this->page_largeur - $this->marge_droite - 100; + $this->posxqtytoship=$this->page_largeur - $this->marge_droite - 70; + $this->posxpuht=$this->page_largeur - $this->marge_droite - 40; + $this->posxtotalht=$this->page_largeur - $this->marge_droite - 20; + + } + $this->posxpicture=$this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format @@ -464,7 +476,17 @@ class pdf_rouget extends ModelePdfExpedition } $pdf->SetXY($this->posxqtytoship, $curY); - $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C'); + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C'); + + if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) +{ + $pdf->SetXY($this->posxpuht, $curY); + $pdf->MultiCell(($this->posxtotalht - $this->posxpuht-1), 3, price($object->lines[$i]->subprice, 0, $outputlangs),'','R'); + + $pdf->SetXY($this->posxtotalht, $curY); + $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3, price($object->lines[$i]->total_ht, 0, $outputlangs),'','R'); + + } // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) @@ -628,7 +650,17 @@ class pdf_rouget extends ModelePdfExpedition } $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($this->largeur_page - $this->marge_droite - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1); + $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1); + + if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) { + + $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl, '', 0, 'C', 1); + + $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl, price($object->total_ht, 0, $outputlangs), 0, 'C', 1); + + } // Total Weight if ($totalWeighttoshow) @@ -713,8 +745,27 @@ class pdf_rouget extends ModelePdfExpedition if (empty($hidetop)) { $pdf->SetXY($this->posxqtytoship, $tab_top+1); - $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToShip"),'','C'); + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToShip"),'','C'); } + + if(!empty($conf->global->MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT)) { + + $pdf->line($this->posxpuht-1, $tab_top, $this->posxpuht-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxpuht-1, $tab_top+1); + $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities("PriceUHT"),'','C'); + } + + $pdf->line($this->posxtotalht-1, $tab_top, $this->posxtotalht-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxtotalht-1, $tab_top+1); + $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 2, $outputlangs->transnoentities("TotalHT"),'','C'); + } + + } + } /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 306dfbbb9a7..26cfd08775e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -50,89 +50,89 @@ class CommandeFournisseur extends CommonOrder */ protected $table_ref_field = 'ref'; - var $id; + public $id; /** * Supplier order reference * @var string */ - var $ref; - var $ref_supplier; - var $brouillon; - var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially + public $ref; + public $ref_supplier; + public $brouillon; + public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process runing // -> 6=Canceled -> (reopen) 2=Approved // -> 9=Refused -> (reopen) 1=Validated // Note: billed or not is on another field "billed" - var $statuts; // List of status - - var $socid; - var $fourn_id; - var $date; - var $date_valid; - var $date_approve; - var $date_approve2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set - var $date_commande; + public $statuts; // List of status + + public $socid; + public $fourn_id; + public $date; + public $date_valid; + public $date_approve; + public $date_approve2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set + public $date_commande; /** * Delivery date */ - var $date_livraison; - var $total_ht; - var $total_tva; - var $total_localtax1; // Total Local tax 1 - var $total_localtax2; // Total Local tax 2 - var $total_ttc; - var $source; + public $date_livraison; + public $total_ht; + public $total_tva; + public $total_localtax1; // Total Local tax 1 + public $total_localtax2; // Total Local tax 2 + public $total_ttc; + public $source; /** * @deprecated * @see note_private, note_public */ - var $note; + public $note; public $note_private; public $note_public; - var $model_pdf; - var $fk_project; - var $cond_reglement_id; - var $cond_reglement_code; - var $fk_account; - var $mode_reglement_id; - var $mode_reglement_code; - var $user_author_id; - var $user_valid_id; - var $user_approve_id; - var $user_approve_id2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set + public $model_pdf; + public $fk_project; + public $cond_reglement_id; + public $cond_reglement_code; + public $fk_account; + public $mode_reglement_id; + public $mode_reglement_code; + public $user_author_id; + public $user_valid_id; + public $user_approve_id; + public $user_approve_id2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set //Incoterms - var $fk_incoterms; - var $location_incoterms; - var $libelle_incoterms; //Used into tooltip + public $fk_incoterms; + public $location_incoterms; + public $libelle_incoterms; //Used into tooltip - var $extraparams=array(); + public $extraparams=array(); /** * @var CommandeFournisseurLigne[] */ public $lines = array(); //Add for supplier_proposal - var $origin; - var $origin_id; - var $linked_objects=array(); + public $origin; + public $origin_id; + public $linked_objects=array(); // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Constructor * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf; @@ -161,7 +161,7 @@ class CommandeFournisseur extends CommonOrder * @param string $ref Ref of object * @return int >0 if OK, <0 if KO, 0 if not found */ - function fetch($id,$ref='') + public function fetch($id,$ref='') { global $conf; @@ -373,7 +373,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, >0 if OK */ - function valid($user,$idwarehouse=0,$notrigger=0) + public function valid($user,$idwarehouse=0,$notrigger=0) { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -492,7 +492,7 @@ class CommandeFournisseur extends CommonOrder * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto * @return string Label */ - function getLibStatut($mode=0) + public function getLibStatut($mode=0) { return $this->LibStatut($this->statut,$mode,$this->billed); } @@ -584,7 +584,7 @@ class CommandeFournisseur extends CommonOrder * @param string $option On what the link points * @return string Chain with URL */ - function getNomUrl($withpicto=0,$option='') + public function getNomUrl($withpicto=0,$option='') { global $langs, $conf; @@ -620,7 +620,7 @@ class CommandeFournisseur extends CommonOrder * @param Societe $soc company object * @return string free reference for the invoice */ - function getNextNumRef($soc) + public function getNextNumRef($soc) { global $db, $langs, $conf; $langs->load("orders"); @@ -674,8 +674,9 @@ class CommandeFournisseur extends CommonOrder * @param User $user Object user making the change * @return int <0 if KO, >0 if KO */ - function classifyBilled(User $user) + public function classifyBilled(User $user) { + $error=0; $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1'; @@ -720,7 +721,7 @@ class CommandeFournisseur extends CommonOrder * @param int $secondlevel 0=Standard approval, 1=Second level approval (used when option SUPPLIER_ORDER_DOUBLE_APPROVAL is set) * @return int <0 if KO, >0 if OK */ - function approve($user, $idwarehouse=0, $secondlevel=0) + public function approve($user, $idwarehouse=0, $secondlevel=0) { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -805,6 +806,7 @@ class CommandeFournisseur extends CommonOrder // Product with reference if ($this->lines[$i]->fk_product > 0) { + $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; // We decrement stock of product (and sub-products) @@ -812,6 +814,7 @@ class CommandeFournisseur extends CommonOrder if (! empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $this->lines[$i]->remise_percent) / 100, 'MU'); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("OrderApprovedInDolibarr",$this->ref)); if ($result < 0) { $error++; } + unset($this->line); } } } @@ -870,7 +873,7 @@ class CommandeFournisseur extends CommonOrder * @param User $user User making action * @return int 0 if Ok, <0 if Ko */ - function refuse($user) + public function refuse($user) { global $conf, $langs; @@ -988,7 +991,7 @@ class CommandeFournisseur extends CommonOrder * @param string $comment Comment * @return int <0 if KO, >0 if OK */ - function commande($user, $date, $methode, $comment='') + public function commande($user, $date, $methode, $comment='') { global $langs; dol_syslog(get_class($this)."::commande"); @@ -1046,7 +1049,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger Disable all triggers * @return int <0 if KO, Id of supplier order if OK */ - function create($user, $notrigger=0) + public function create($user, $notrigger=0) { global $langs,$conf,$hookmanager; @@ -1217,7 +1220,7 @@ class CommandeFournisseur extends CommonOrder * * @return int New id of clone */ - function createFromClone() + public function createFromClone() { global $conf,$user,$langs,$hookmanager; @@ -1304,7 +1307,7 @@ class CommandeFournisseur extends CommonOrder * @param string $fk_unit Code of the unit to use. Null to use the default one * @return int <=0 if KO, >0 if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null) { global $langs,$mysoc,$conf; @@ -1420,77 +1423,80 @@ class CommandeFournisseur extends CommonOrder $subprice = price2num($pu,'MU'); - // TODO We should use here $this->line=new CommandeFournisseurLigne($this->db); and $this->line->insert(); to work loke other object (proposal, order, invoice) - $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet"; - $sql.= " (fk_commande, label, description, date_start, date_end,"; - $sql.= " fk_product, product_type,"; - $sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; - $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; - $sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc"; - $sql.= ")"; - $sql.= " VALUES (".$this->id.", '" . $this->db->escape($label) . "','" . $this->db->escape($desc) . "',"; - $sql.= " ".($date_start?"'".$this->db->idate($date_start)."'":"null").","; - $sql.= " ".($date_end?"'".$this->db->idate($date_end)."'":"null").","; - if ($fk_product) { $sql.= $fk_product.","; } - else { $sql.= "null,"; } - $sql.= "'".$product_type."',"; - $sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2; + // Insert line + $this->line=new CommandeFournisseurLigne($this->db); - $sql.= ", '".$localtax1_type."',"; - $sql.= " '".$localtax2_type."'"; + $this->line->context = $this->context; - $sql.= ", ".$remise_percent.",'".price2num($subprice,'MU')."','".$ref."',"; - $sql.= "'".price2num($total_ht)."',"; - $sql.= "'".price2num($total_tva)."',"; - $sql.= "'".price2num($total_localtax1)."',"; - $sql.= "'".price2num($total_localtax2)."',"; - $sql.= "'".price2num($total_ttc)."',"; - $sql.= ($fk_unit ? "'".$this->db->escape($fk_unit)."'":"null"); - $sql.= ", ".$this->fk_multicurrency; - $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql.= ", ".price2num($pu_ht * $this->multicurrency_tx); - $sql.= ", ".$multicurrency_total_ht; - $sql.= ", ".$multicurrency_total_tva; - $sql.= ", ".$multicurrency_total_ttc; - $sql.= ")"; + $this->line->fk_commande=$this->id; + $this->line->label=$label; + $this->line->desc=$desc; + $this->line->qty=$qty; + $this->line->tva_tx=$txtva; + $this->line->localtax1_tx=$txlocaltax1; + $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->fk_product=$fk_product; + $this->line->product_type=$product_type; + $this->line->remise_percent=$remise_percent; + $this->line->subprice=$pu_ht; + $this->line->rang=$this->rang; + $this->line->info_bits=$info_bits; + $this->line->total_ht=$total_ht; + $this->line->total_tva=$total_tva; + $this->line->total_localtax1=$total_localtax1; + $this->line->total_localtax2=$total_localtax2; + $this->line->total_ttc=$total_ttc; + $this->line->product_type=$type; + $this->line->special_code=$this->special_code; + $this->line->origin=$this->origin; + $this->line->fk_unit=$fk_unit; - $resql=$this->db->query($sql); - //print $sql; - if ($resql) + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; + + + // Multicurrency + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx); + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + + $this->line->subprice=$pu; + $this->line->price=$this->line->subprice; + + $this->line->remise_percent=$remise_percent; + + if (is_array($array_options) && count($array_options)>0) { + $this->line->array_options=$array_options; + } + + $result=$this->line->insert($notrigger); + if ($result > 0) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $linetmp = new CommandeFournisseurLigne($this->db); - $linetmp->id=$this->db->last_insert_id(MAIN_DB_PREFIX.'commande_fournisseurdet'); - $linetmp->array_options = $array_options; - $result=$linetmp->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + // Reorder if child line + if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); - if (! $error && ! $notrigger) + // Mise a jour informations denormalisees au niveau de la commande meme + $result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + if ($result > 0) { - global $conf, $langs, $user; - // Call trigger - $result=$this->call_trigger('LINEORDER_SUPPLIER_CREATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers + $this->db->commit(); + return $this->line->id; + } + else + { + $this->db->rollback(); + return -1; } - - $this->update_price('','auto'); - - $this->db->commit(); - return 1; } else { - $this->error=$this->db->error(); + $this->error=$this->line->error; + dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -1514,7 +1520,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1 = notrigger * @return int <0 if KO, >0 if OK */ - function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet=0, $notrigger=0) + public function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet=0, $notrigger=0) { global $conf, $langs; @@ -1616,9 +1622,10 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Disable call to triggers * @return <0 if KO, >0 if OK */ - function deleteline($idline, $notrigger=0) + public function deleteline($idline, $notrigger=0) { global $user,$langs,$conf; + $error = 0; if ($this->statut != 0) { @@ -1671,7 +1678,7 @@ class CommandeFournisseur extends CommonOrder * @param User $user Object user * @return int <0 if KO, >0 if OK */ - function delete($user='') + public function delete($user='') { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1822,7 +1829,7 @@ class CommandeFournisseur extends CommonOrder * @param int $status Filter on stats (-1 = no filter, 0 = lines draft to be approved, 1 = approved lines) * @return array Array of lines */ - function getDispachedLines($status=-1) + public function getDispachedLines($status=-1) { $ret = array(); @@ -2048,7 +2055,7 @@ class CommandeFournisseur extends CommonOrder * @param int $comclientid Id of customer order to use as template * @return int <0 if KO, >0 if OK */ - function updateFromCommandeClient($user, $idc, $comclientid) + public function updateFromCommandeClient($user, $idc, $comclientid) { $comclient = new Commande($this->db); $comclient->fetch($comclientid); @@ -2089,7 +2096,7 @@ class CommandeFournisseur extends CommonOrder * @param int $status New status * @return int <0 if KO, >0 if OK */ - function setStatus($user,$status) + public function setStatus($user,$status) { global $conf,$langs; $error=0; @@ -2147,12 +2154,14 @@ class CommandeFournisseur extends CommonOrder * @param string $fk_unit Code of the unit to use. Null to use the default one * @return int < 0 if error, > 0 if ok */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null) + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit=null) { - global $mysoc; + global $mysoc, $conf; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + $error = 0; + if ($this->brouillon) { $this->db->begin(); @@ -2202,83 +2211,62 @@ class CommandeFournisseur extends CommonOrder $subprice = price2num($pu,'MU'); - // Mise a jour ligne en base - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseurdet SET"; - $sql.= " description='".$this->db->escape($desc)."'"; - $sql.= ",subprice='".price2num($subprice)."'"; - //$sql.= ",remise='".price2num($remise)."'"; - $sql.= ",remise_percent='".price2num($remise_percent)."'"; - $sql.= ",tva_tx='".price2num($txtva)."'"; - $sql.= ",localtax1_tx='".price2num($txlocaltax1)."'"; - $sql.= ",localtax2_tx='".price2num($txlocaltax2)."'"; - $sql.= ",localtax1_type='".$localtax1_type."'"; - $sql.= ",localtax2_type='".$localtax2_type."'"; - $sql.= ",qty='".price2num($qty)."'"; - $sql.= ",date_start=".(! empty($date_start)?"'".$this->db->idate($date_start)."'":"null"); - $sql.= ",date_end=".(! empty($date_end)?"'".$this->db->idate($date_end)."'":"null"); - $sql.= ",info_bits='".$info_bits."'"; - $sql.= ",total_ht='".price2num($total_ht)."'"; - $sql.= ",total_tva='".price2num($total_tva)."'"; - $sql.= ",total_localtax1='".price2num($total_localtax1)."'"; - $sql.= ",total_localtax2='".price2num($total_localtax2)."'"; - $sql.= ",total_ttc='".price2num($total_ttc)."'"; - $sql.= ",product_type=".$type; - $sql.= ($fk_unit ? ",fk_unit='".$this->db->escape($fk_unit)."'":", fk_unit=null"); - - // Multicurrency - $sql.= " , multicurrency_subprice=".price2num($subprice * $this->multicurrency_tx).""; - $sql.= " , multicurrency_total_ht=".price2num($multicurrency_total_ht).""; - $sql.= " , multicurrency_total_tva=".price2num($multicurrency_total_tva).""; - $sql.= " , multicurrency_total_ttc=".price2num($multicurrency_total_ttc).""; - - $sql.= " WHERE rowid = ".$rowid; + $this->line=new CommandeFournisseurLigne($this->db); + $this->line->fetch($rowid); - dol_syslog(get_class($this)."::updateline", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result > 0) + $this->line->context = $this->context; + + $this->line->fk_commande=$this->id; + //$this->line->label=$label; + $this->line->desc=$desc; + $this->line->qty=$qty; + $this->line->tva_tx=$txtva; + $this->line->localtax1_tx=$txlocaltax1; + $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->remise_percent=$remise_percent; + $this->line->subprice=$pu; + $this->line->rang=$this->rang; + $this->line->info_bits=$info_bits; + $this->line->total_ht=$total_ht; + $this->line->total_tva=$total_tva; + $this->line->total_localtax1=$total_localtax1; + $this->line->total_localtax2=$total_localtax2; + $this->line->total_ttc=$total_ttc; + $this->line->product_type=$type; + $this->line->special_code=$this->special_code; + $this->line->origin=$this->origin; + $this->line->fk_unit=$fk_unit; + + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; + + + // Multicurrency + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx); + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + + $this->line->subprice=$pu; + $this->line->price=$this->line->subprice; + + $this->line->remise_percent=$remise_percent; + + if (is_array($array_options) && count($array_options)>0) { + $this->line->array_options=$array_options; + } + + $result=$this->line->update($notrigger); + + + // Mise a jour info denormalisees au niveau facture + if (! $error) { - $this->rowid = $rowid; - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $tmpline = new CommandeFournisseurLigne($this->db); - $tmpline->id=$this->rowid; - $tmpline->array_options = $array_options; - $result=$tmpline->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - - if (! $error && ! $notrigger) - { - global $conf, $langs, $user; - // Call trigger - $result=$this->call_trigger('LINEORDER_SUPPLIER_UPDATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers - } - - // Mise a jour info denormalisees au niveau facture - if (! $error) - { - $this->update_price('','auto'); - } - - if (! $error) - { - $this->db->commit(); - return $result; - } - else - { - $this->db->rollback(); - return -1; - } + $this->update_price('','auto'); } else { @@ -2303,7 +2291,7 @@ class CommandeFournisseur extends CommonOrder * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $user,$langs,$conf; @@ -2385,7 +2373,7 @@ class CommandeFournisseur extends CommonOrder * @param int $id Id de la facture a charger * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT c.rowid, date_creation as datec, tms as datem, date_valid as date_validation, date_approve as datea, date_approve2 as datea2,'; $sql.= ' fk_user_author, fk_user_modif, fk_user_valid, fk_user_approve, fk_user_approve2'; @@ -2523,7 +2511,7 @@ class CommandeFournisseur extends CommonOrder * * @return string */ - function getInputMethod() + public function getInputMethod() { global $db, $langs; @@ -2593,7 +2581,7 @@ class CommandeFournisseur extends CommonOrder * @param Translate $langs Language object * @return Translated string */ - function getMaxDeliveryTimeDay($langs) + public function getMaxDeliveryTimeDay($langs) { if (empty($this->lines)) return ''; @@ -2689,17 +2677,31 @@ class CommandeFournisseur extends CommonOrder */ class CommandeFournisseurLigne extends CommonOrderLine { - public $element='commande_fournisseurdet'; + public $element='commande_fournisseurdet'; public $table_element='commande_fournisseurdet'; + public $oldline; + + /** + * Id of parent order + * @var int + */ + public $fk_commande; + + // From llx_commande_fournisseurdet + public $fk_parent_line; + public $fk_facture; + public $label; + public $rang = 0; + /** * Unit price without taxes * @var float */ public $pu_ht; - var $date_start; - var $date_end; + public $date_start; + public $date_end; // From llx_product_fournisseur_price @@ -2715,7 +2717,9 @@ class CommandeFournisseurLigne extends CommonOrderLine * Supplier reference * @var string */ - public $ref_supplier; + public $ref_supplier; + public $remise; + public $product_libelle; /** @@ -2723,7 +2727,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db= $db; } @@ -2734,7 +2738,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * @param int $rowid Id line order * @return int <0 if KO, >0 if OK */ - function fetch($rowid) + public function fetch($rowid) { $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx,'; $sql.= ' cd.localtax1_tx, cd.localtax2_tx,'; @@ -2751,6 +2755,7 @@ class CommandeFournisseurLigne extends CommonOrderLine { $objp = $this->db->fetch_object($result); $this->rowid = $objp->rowid; + $this->id = $objp->rowid; $this->fk_commande = $objp->fk_commande; $this->desc = $objp->description; $this->qty = $objp->qty; @@ -2770,6 +2775,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->product_type = $objp->product_type; $this->ref = $objp->product_ref; + $this->product_ref = $objp->product_ref; $this->product_libelle = $objp->product_libelle; $this->product_desc = $objp->product_desc; @@ -2792,7 +2798,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * * @return int <0 si ko, >0 si ok */ - function update_total() + public function updateTotal() { $this->db->begin(); @@ -2805,7 +2811,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("CommandeFournisseurLigne.class.php::update_total", LOG_DEBUG); + dol_syslog(get_class($this)."::updateTotal", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2820,5 +2826,209 @@ class CommandeFournisseurLigne extends CommonOrderLine return -2; } } + + /** + * Insert line into database + * + * @param int $notrigger 1 = disable triggers + * @return int <0 if KO, >0 if OK + */ + public function insert($notrigger=0) + { + global $conf, $user; + + $error=0; + + dol_syslog(get_class($this)."::insert rang=".$this->rang); + + // Clean parameters + if (empty($this->tva_tx)) $this->tva_tx=0; + if (empty($this->localtax1_tx)) $this->localtax1_tx=0; + if (empty($this->localtax2_tx)) $this->localtax2_tx=0; + if (empty($this->localtax1_type)) $this->localtax1_type=0; + if (empty($this->localtax2_type)) $this->localtax2_type=0; + if (empty($this->total_localtax1)) $this->total_localtax1=0; + if (empty($this->total_localtax2)) $this->total_localtax2=0; + if (empty($this->rang)) $this->rang=0; + if (empty($this->remise)) $this->remise=0; + if (empty($this->remise_percent)) $this->remise_percent=0; + if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->special_code)) $this->special_code=0; + if (empty($this->fk_parent_line)) $this->fk_parent_line=0; + if (empty($this->pa_ht)) $this->pa_ht=0; + + + // Check parameters + if ($this->product_type < 0) return -1; + + $this->db->begin(); + + // Insertion dans base de la ligne + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; + $sql.= " (fk_commande, label, description, date_start, date_end,"; + $sql.= " fk_product, product_type,"; + $sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; + $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; + $sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc"; + $sql.= ")"; + $sql.= " VALUES (".$this->fk_commande.", '" . $this->db->escape($this->product_label) . "','" . $this->db->escape($this->desc) . "',"; + $sql.= " ".($this->date_start?"'".$this->db->idate($this->date_start)."'":"null").","; + $sql.= " ".($this->date_end?"'".$this->db->idate($this->date_end)."'":"null").","; + if ($this->fk_product) { $sql.= $this->fk_product.","; } + else { $sql.= "null,"; } + $sql.= "'".$this->product_type."',"; + $sql.= "'".$this->qty."', ".$this->tva_tx.", ".$this->localtax1_tx.", ".$this->localtax2_tx; + + $sql.= ", '".$this->localtax1_type."',"; + $sql.= " '".$this->localtax2_type."'"; + + $sql.= ", ".$this->remise_percent.",'".price2num($this->subprice,'MU')."','".$this->product_ref."',"; + $sql.= "'".price2num($this->total_ht)."',"; + $sql.= "'".price2num($this->total_tva)."',"; + $sql.= "'".price2num($this->total_localtax1)."',"; + $sql.= "'".price2num($this->total_localtax2)."',"; + $sql.= "'".price2num($this->total_ttc)."',"; + $sql.= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'":"null"); + $sql.= ", ".$this->fk_multicurrency; + $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; + $sql.= ", ".price2num($this->pu_ht * $this->multicurrency_tx); + $sql.= ", ".$this->multicurrency_total_ht; + $sql.= ", ".$this->multicurrency_total_tva; + $sql.= ", ".$this->multicurrency_total_ttc; + $sql.= ")"; + + dol_syslog(get_class($this)."::insert", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + $this->rowid =$this->id; + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEORDER_INSERT',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (!$error) { + $this->db->commit(); + return 1; + } + + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->errors[]=($this->errors?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->errors[]=$this->db->error(); + $this->db->rollback(); + return -2; + } + } + /** + * Update the line object into db + * + * @param int $notrigger 1 = disable triggers + * @return int <0 si ko, >0 si ok + */ + public function update($notrigger=0) + { + global $conf,$user; + + $error=0; + + // Mise a jour ligne en base + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; + $sql.= " description='".$this->db->escape($this->desc)."'"; + $sql.= ",subprice='".price2num($this->subprice)."'"; + //$sql.= ",remise='".price2num($remise)."'"; + $sql.= ",remise_percent='".price2num($this->remise_percent)."'"; + $sql.= ",tva_tx='".price2num($this->tva_tx)."'"; + $sql.= ",localtax1_tx='".price2num($this->total_localtax1)."'"; + $sql.= ",localtax2_tx='".price2num($this->total_localtax2)."'"; + $sql.= ",localtax1_type='".$this->localtax1_type."'"; + $sql.= ",localtax2_type='".$this->localtax2_type."'"; + $sql.= ",qty='".price2num($this->qty)."'"; + $sql.= ",date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); + $sql.= ",date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); + $sql.= ",info_bits='".$this->info_bits."'"; + $sql.= ",total_ht='".price2num($this->total_ht)."'"; + $sql.= ",total_tva='".price2num($this->total_tva)."'"; + $sql.= ",total_localtax1='".price2num($this->total_localtax1)."'"; + $sql.= ",total_localtax2='".price2num($this->total_localtax2)."'"; + $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; + $sql.= ",product_type=".$this->product_type; + $sql.= ($this->fk_unit ? ",fk_unit='".$this->db->escape($this->fk_unit)."'":", fk_unit=null"); + + // Multicurrency + $sql.= " , multicurrency_subprice=".price2num($this->subprice * $this->multicurrency_tx).""; + $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; + $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; + $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result > 0) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + if (! $error && ! $notrigger) + { + global $user; + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_UPDATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return $result; + } + else + { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + } } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8c1a86b03a5..aab90ce4b49 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -50,57 +50,57 @@ class FactureFournisseur extends CommonInvoice */ protected $table_ref_field = 'ref'; - var $rowid; - var $ref; - var $product_ref; - var $ref_supplier; - var $socid; + public $rowid; + public $ref; + public $product_ref; + public $ref_supplier; + public $socid; //Check constants for types - var $type = self::TYPE_STANDARD; + public $type = self::TYPE_STANDARD; /** * Supplier invoice status * @var int * @see FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_PAID, FactureFournisseur::STATUS_ABANDONED */ - var $statut; + public $statut; /** * Set to 1 if the invoice is completely paid, otherwise is 0 * @var int * @deprecated Use statuses stored in self::statut */ - var $paye; + public $paye; - var $author; - var $libelle; - var $datec; // Creation date - var $tms; // Last update date - var $date; // Invoice date - var $date_echeance; // Max payment date - var $amount; - var $remise; - var $tva; - var $localtax1; - var $localtax2; - var $total_ht; - var $total_tva; - var $total_localtax1; - var $total_localtax2; - var $total_ttc; + public $author; + public $libelle; + public $datec; // Creation date + public $tms; // Last update date + public $date; // Invoice date + public $date_echeance; // Max payment date + public $amount; + public $remise; + public $tva; + public $localtax1; + public $localtax2; + public $total_ht; + public $total_tva; + public $total_localtax1; + public $total_localtax2; + public $total_ttc; /** * @deprecated * @see note_private, note_public */ - var $note; - var $note_private; - var $note_public; - var $propalid; - var $cond_reglement_id; - var $cond_reglement_code; - var $fk_account; - var $mode_reglement_id; - var $mode_reglement_code; + public $note; + public $note_private; + public $note_public; + public $propalid; + public $cond_reglement_id; + public $cond_reglement_code; + public $fk_account; + public $mode_reglement_id; + public $mode_reglement_code; /** * Invoice lines @@ -110,29 +110,29 @@ class FactureFournisseur extends CommonInvoice /** * @deprecated */ - var $fournisseur; + public $fournisseur; //Incorterms - var $fk_incoterms; - var $location_incoterms; - var $libelle_incoterms; //Used into tooltip + public $fk_incoterms; + public $location_incoterms; + public $libelle_incoterms; //Used into tooltip - var $extraparams=array(); + public $extraparams=array(); // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_tx; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Constructor * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; @@ -155,7 +155,7 @@ class FactureFournisseur extends CommonInvoice * @param User $user object utilisateur qui cree * @return int id facture si ok, < 0 si erreur */ - function create($user) + public function create($user) { global $langs,$conf,$hookmanager; @@ -355,7 +355,7 @@ class FactureFournisseur extends CommonInvoice * @param string $ref Ref supplier invoice * @return int <0 if KO, >0 if OK, 0 if not found */ - function fetch($id='',$ref='') + public function fetch($id='',$ref='') { global $langs; @@ -613,7 +613,7 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + public function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -741,7 +741,7 @@ class FactureFournisseur extends CommonInvoice * @param int $rowid Id of invoice to delete * @return int <0 if KO, >0 if OK */ - function delete($rowid) + public function delete($rowid) { global $user,$langs,$conf; @@ -955,7 +955,7 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, =0 if nothing to do, >0 if OK */ - function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) + public function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) { global $conf,$langs; @@ -1011,6 +1011,7 @@ class FactureFournisseur extends CommonInvoice { if ($this->lines[$i]->fk_product > 0) { + $this->line = $this->lines[$i]; $mouvP = new MouvementStock($this->db); $mouvP->origin = &$this; // We increase stock for product @@ -1018,6 +1019,7 @@ class FactureFournisseur extends CommonInvoice if (! empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $this->lines[$i]->remise_percent) / 100, 'MU'); $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("InvoiceValidatedInDolibarr",$num)); if ($result < 0) { $error++; } + unset($this->line); } } } @@ -1194,14 +1196,16 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger Disable triggers * @param array $array_options extrafields array * @param string $fk_unit Code of the unit to use. Null to use the default one + * @param int $origin_id id origin document * @return int >0 if OK, <0 if KO * * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. */ - function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null) + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0) { dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + global $mysoc; // Clean parameters if (empty($remise_percent)) $remise_percent=0; @@ -1220,52 +1224,92 @@ class FactureFournisseur extends CommonInvoice $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty); + + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx); + $total_ht = $tabprice[0]; + $total_tva = $tabprice[1]; + $total_ttc = $tabprice[2]; + $total_localtax1 = $tabprice[9]; + $total_localtax2 = $tabprice[10]; + + // MultiCurrency + $multicurrency_total_ht = $tabprice[16]; + $multicurrency_total_tva = $tabprice[17]; + $multicurrency_total_ttc = $tabprice[18]; + // Check parameters if ($type < 0) return -1; + // Insert line + $this->line=new SupplierInvoiceLine($this->db); - $this->db->begin(); + $this->line->context = $this->context; - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; - $sql.= ' VALUES ('.$this->id.')'; - dol_syslog(get_class($this)."::addline", LOG_DEBUG); + $this->line->fk_facture_fourn=$this->id; + //$this->line->label=$label; // deprecated + $this->line->desc=$desc; + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + $this->line->tva_tx=$txtva; + $this->line->localtax1_tx=$txlocaltax1; + $this->line->localtax2_tx=$txlocaltax2; + $this->line->fk_product=$fk_product; + $this->line->product_type=$type; + $this->line->remise_percent=$remise_percent; + $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu):$pu); // For credit note, unit price always negative, always positive otherwise + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; + $this->line->ventil=$ventil; + $this->line->rang=$rang; + $this->line->info_bits=$info_bits; + $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative + $this->line->total_tva= $total_tva; + $this->line->total_localtax1=$total_localtax1; + $this->line->total_localtax2=$total_localtax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + $this->line->special_code=$this->special_code; + $this->line->fk_parent_line=$this->fk_parent_line; + $this->line->origin=$this->origin; + $this->line->origin_id=$origin_id; + $this->line->fk_unit=$fk_unit; - $resql = $this->db->query($sql); - if ($resql) + // Multicurrency + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->multicurrency_subprice = price2num($this->line->subprice * $this->multicurrency_tx); + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + + if (is_array($array_options) && count($array_options)>0) { + $this->line->array_options=$array_options; + } + + $result=$this->line->insert($notrigger); + if ($result > 0) { - $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); + // Reorder if child line + if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); - $result=$this->updateline($idligne, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product, $price_base_type, $info_bits, $type, $remise_percent, true, '', '', $array_options, $fk_unit); + // Mise a jour informations denormalisees au niveau de la facture meme + $result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode. if ($result > 0) { - $this->rowid = $idligne; - - if (! $notrigger) - { - global $conf, $langs, $user; - // Call trigger - $result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers - } - $this->db->commit(); - return 1; + return $this->line->id; } else { - dol_syslog("Error after updateline error=".$this->error, LOG_ERR); + $this->error=$this->db->error(); $this->db->rollback(); return -1; } } else { - $this->error=$this->db->lasterror(); + $this->error=$this->line->error; $this->db->rollback(); return -2; } @@ -1293,7 +1337,7 @@ class FactureFournisseur extends CommonInvoice * @param string $fk_unit Code of the unit to use. Null to use the default one * @return int <0 if KO, >0 if OK */ - function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit = null) + public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false, $date_start='', $date_end='', $array_options=0, $fk_unit = null) { global $mysoc; dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$fk_unit", LOG_DEBUG); @@ -1315,6 +1359,8 @@ class FactureFournisseur extends CommonInvoice $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); + $localtaxes_type = array($txlocaltax1,$txlocaltax2); + // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker @@ -1404,7 +1450,7 @@ class FactureFournisseur extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function deleteline($rowid, $notrigger=0) + public function deleteline($rowid, $notrigger=0) { if (!$rowid) { $rowid = $this->id; @@ -1434,7 +1480,7 @@ class FactureFournisseur extends CommonInvoice * @param int $id Id de la facture a charger * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT c.rowid, datec, tms as datem, '; $sql.= ' fk_user_author, fk_user_modif, fk_user_valid'; @@ -1543,9 +1589,9 @@ class FactureFournisseur extends CommonInvoice * @param int $max Max length of shown ref * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$max=0) + public function getNomUrl($withpicto=0,$option='',$max=0) { - global $langs; + global $langs, $conf; $result=''; $label = '' . $langs->trans("ShowSupplierInvoice") . ''; @@ -1587,7 +1633,7 @@ class FactureFournisseur extends CommonInvoice * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($soc,$mode='next') + public function getNextNumRef($soc,$mode='next') { global $db, $langs, $conf; $langs->load("orders"); @@ -1640,7 +1686,7 @@ class FactureFournisseur extends CommonInvoice * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $langs,$conf; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -1780,7 +1826,7 @@ class FactureFournisseur extends CommonInvoice * @param int $invertdetail Reverse sign of amounts for lines * @return int New id of clone */ - function createFromClone($fromid,$invertdetail=0) + public function createFromClone($fromid,$invertdetail=0) { global $user,$langs; @@ -1942,7 +1988,7 @@ class SupplierInvoiceLine extends CommonObjectLine public $element='facture_fourn_det'; public $table_element='facture_fourn_det'; - var $oldline; + public $oldline; /** * @deprecated @@ -1999,22 +2045,22 @@ class SupplierInvoiceLine extends CommonObjectLine * Id of the corresponding supplier invoice * @var int */ - var $fk_facture_fourn; + public $fk_facture_fourn; /** * Product label * This field may contains label of product (when invoice create from order) * @var string */ - var $label; + public $label; /** * Description of the line * @var string */ - var $description; + public $description; - var $skip_update_total; // Skip update price total for special lines + public $skip_update_total; // Skip update price total for special lines /** * @var int Situation advance percentage @@ -2046,19 +2092,19 @@ class SupplierInvoiceLine extends CommonObjectLine public $localtax2_type; // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_subprice; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_subprice; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Constructor * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db= $db; } @@ -2292,5 +2338,146 @@ class SupplierInvoiceLine extends CommonObjectLine $this->db->commit(); return 1; } + + /** + * Insert line into database + * + * @param int $notrigger 1 no triggers + * @return int <0 if KO, >0 if OK + */ + public function insert($notrigger=0) + { + global $user,$conf; + + $error=0; + + dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); + + // Clean parameters + $this->desc=trim($this->desc); + if (empty($this->tva_tx)) $this->tva_tx=0; + if (empty($this->localtax1_tx)) $this->localtax1_tx=0; + if (empty($this->localtax2_tx)) $this->localtax2_tx=0; + if (empty($this->localtax1_type)) $this->localtax1_type=0; + if (empty($this->localtax2_type)) $this->localtax2_type=0; + if (empty($this->total_localtax1)) $this->total_localtax1=0; + if (empty($this->total_localtax2)) $this->total_localtax2=0; + if (empty($this->rang)) $this->rang=0; + if (empty($this->remise_percent)) $this->remise_percent=0; + if (empty($this->info_bits)) $this->info_bits=0; + if (empty($this->subprice)) $this->subprice=0; + if (empty($this->special_code)) $this->special_code=0; + if (empty($this->fk_parent_line)) $this->fk_parent_line=0; + if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100; + + 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_tva)) $this->multicurrency_total_tva=0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; + + + // Check parameters + if ($this->product_type < 0) + { + $this->error='ErrorProductTypeMustBe0orMore'; + return -1; + } + if (! empty($this->fk_product)) + { + // Check product exists + $result=Product::isExistingObject('product', $this->fk_product); + if ($result <= 0) + { + $this->error='ErrorProductIdDoesNotExists'; + return -1; + } + } + + $this->db->begin(); + + // Insertion dans base de la ligne + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; + $sql.= ' (fk_facture_fourn, fk_parent_line, label, description, qty,'; + $sql.= ' tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql.= ' fk_product, product_type, remise_percent, pu_ht, pu_ttc,'; + $sql.= ' date_start, date_end, fk_code_ventilation, rang, special_code,'; + $sql.= ' info_bits, total_ht, tva, total_ttc, total_localtax1, total_localtax2, fk_unit'; + $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; + $sql.= ')'; + $sql.= " VALUES (".$this->fk_facture_fourn.","; + $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; + $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; + $sql.= " '".$this->db->escape($this->desc)."',"; + $sql.= " ".price2num($this->qty).","; + $sql.= " ".price2num($this->tva_tx).","; + $sql.= " ".price2num($this->localtax1_tx).","; + $sql.= " ".price2num($this->localtax2_tx).","; + $sql.= " '".$this->localtax1_type."',"; + $sql.= " '".$this->localtax2_type."',"; + $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; + $sql.= " ".$this->product_type.","; + $sql.= " ".price2num($this->remise_percent).","; + $sql.= " ".price2num($this->subprice).","; + $sql.= " ".price2num($this->total_ttc/$this->qty).","; + $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").","; + $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").","; + $sql.= ' '.(!empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; + $sql.= ' '.$this->rang.','; + $sql.= ' '.$this->special_code.','; + $sql.= " '".$this->info_bits."',"; + $sql.= " ".price2num($this->total_ht).","; + $sql.= " ".price2num($this->total_tva).","; + $sql.= " ".price2num($this->total_ttc).","; + $sql.= " ".price2num($this->total_localtax1).","; + $sql.= " ".price2num($this->total_localtax2); + $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql.= ", ".(int) $this->fk_multicurrency; + $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; + $sql.= ", ".price2num($this->multicurrency_subprice); + $sql.= ", ".price2num($this->multicurrency_total_ht); + $sql.= ", ".price2num($this->multicurrency_total_tva); + $sql.= ", ".price2num($this->multicurrency_total_ttc); + $sql.= ')'; + + dol_syslog(get_class($this)."::insert", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + $this->rowid=$this->id; + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -2; + } + // End call triggers + } + + $this->db->commit(); + return $this->id; + + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -2; + } + } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 280664ea421..a8239bcb7fb 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -476,7 +476,8 @@ if (empty($reshook)) $lines[$i]->rang, 0, $lines[$i]->array_options, - $lines[$i]->fk_unit + $lines[$i]->fk_unit, + $lines[$i]->id ); if ($result < 0) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 66a9f7f77bb..c2326d58486 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -1,11 +1,11 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013-2014 Juanjo Menent +/* Copyright (C) 2004-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013-2014 Juanjo Menent * Copyright (C) 2014 Marcos García - * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2015-2016 Raphaël Doursenaud * * 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 @@ -28,6 +28,8 @@ */ include_once 'inc.php'; +global $langs; + $err = 0; $allowinstall = 0; $allowupgrade = false; @@ -42,7 +44,10 @@ $langs->load("install"); $useforcedwizard=false; $forcedfile="./install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; -if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; } +if (@file_exists($forcedfile)) { + $useforcedwizard = true; + include_once $forcedfile; +} dolibarr_install_syslog("--- check: Dolibarr install/upgrade process started"); diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index d0cf9a4a385..1782be430bc 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -1,10 +1,11 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Sebastien DiCintio - * Copyright (C) 2005-2011 Regis Houssin +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Sebastien DiCintio + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2016 Raphaël Doursenaud * * 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 @@ -28,6 +29,8 @@ include_once 'inc.php'; +global $langs; + $err=0; $setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):(isset($_GET["lang"])?$_GET["lang"]:'auto'); @@ -58,12 +61,10 @@ $useforcedwizard=false; $forcedfile="./install.forced.php"; if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; // Must be after inc.php if (@file_exists($forcedfile)) { - $useforcedwizard=true; include_once $forcedfile; + $useforcedwizard = true; + include_once $forcedfile; } -//$force_install_message='This is the message'; -//$force_install_noedit=1; - /* * View @@ -120,37 +121,20 @@ if (! empty($force_install_message)) print $langs->trans("WebPagesDirectory"); print ""; - if(! isset($dolibarr_main_url_root) || dol_strlen($dolibarr_main_url_root) == 0) - { - //print "x".$_SERVER["SCRIPT_FILENAME"]." y".$_SERVER["DOCUMENT_ROOT"]; - - // Si le php fonctionne en CGI, alors SCRIPT_FILENAME vaut le path du php et - // ce n'est pas ce qu'on veut. Dans ce cas, on propose $_SERVER["DOCUMENT_ROOT"] - if (preg_match('/^php$/i',$_SERVER["SCRIPT_FILENAME"]) || preg_match('/[\\/]php$/i',$_SERVER["SCRIPT_FILENAME"]) || preg_match('/php\.exe$/i',$_SERVER["SCRIPT_FILENAME"])) - { - $dolibarr_main_document_root=$_SERVER["DOCUMENT_ROOT"]; - - if (! preg_match('/[\\/]dolibarr[\\/]htdocs$/i',$dolibarr_main_document_root)) - { - $dolibarr_main_document_root.="/dolibarr/htdocs"; - } - } - else - { - $dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,dol_strlen($_SERVER["SCRIPT_FILENAME"]) - 21); - // Nettoyage du path propose - // Gere les chemins windows avec double "\" - $dolibarr_main_document_root = str_replace('\\\\','/',$dolibarr_main_document_root); - - // Supprime les slash ou antislash de fins - $dolibarr_main_document_root = preg_replace('/[\\/]+$/','',$dolibarr_main_document_root); - } + if (empty($dolibarr_main_url_root)) { + $dolibarr_main_document_root = detect_dolibarr_main_document_root(); } ?> - '; - print ''; - ?> + + + > + trans("WithNoSlashAtTheEnd")."
"; print $langs->trans("Examples").":
"; @@ -167,24 +151,21 @@ if (! empty($force_install_message)) trans("DocumentsDirectory"); ?> - '; - print ''; - ?> + + + > + trans("WithNoSlashAtTheEnd")."
"; print $langs->trans("DirectoryRecommendation")."
"; @@ -199,39 +180,23 @@ if (! empty($force_install_message)) trans("URLRoot"); ?> - '; - print ''; - ?> + + + > + trans("Examples").":
"; ?>
  • http://localhost/
  • @@ -245,9 +210,17 @@ if (! empty($force_install_message)) ?> trans("ForceHttps"); ?> - > + + + + > + trans("CheckToForceHttps"); ?> @@ -265,13 +238,18 @@ if (! empty($force_install_message)) - trans("DatabaseName"); ?> - - - - trans("DatabaseName"); ?> + trans("DatabaseName"); ?> + + + + > + + trans("DatabaseName"); ?> @@ -286,7 +264,8 @@ if (! empty($force_install_message)) trans("DriverType"); ?> - + + - if ($force_install_noedit && $force_install_type) print ''; - print ''; - - ?> + trans("DatabaseType"); ?> @@ -356,11 +339,14 @@ if (! empty($force_install_message)) trans("Server"); ?> - - value=""> - '; ?> + + + > trans("ServerAddressDescription"); ?> @@ -369,11 +355,15 @@ if (! empty($force_install_message)) trans("Port"); ?> - - value=""> - '; ?> + + + > trans("ServerPortDescription"); ?> @@ -383,20 +373,33 @@ if (! empty($force_install_message)) trans("DatabasePrefix"); ?> - - + + + > + trans("DatabasePrefix"); ?> trans("CreateDatabase"); ?> - - > + + + + > + trans("CheckToCreateDatabase"); ?> @@ -404,33 +407,54 @@ if (! empty($force_install_message)) trans("Login"); ?> - + + + > + trans("AdminLogin"); ?> trans("Password"); ?> - + + + > + trans("AdminPassword"); ?> trans("CreateUser"); ?> - - > + + + + > + trans("CheckToCreateUser"); ?> @@ -438,8 +462,8 @@ if (! empty($force_install_message))
    @@ -449,9 +473,17 @@ if (! empty($force_install_message)) trans("Login"); ?> - + + + > + trans("DatabaseRootLoginDescription"); ?>