diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 67f1e2909fc..aac8f603054 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -544,16 +544,16 @@ if ($id) { if (! empty($user->rights->banque->modifier)) { - print ''.$langs->trans("Delete").''; + print '
'.$langs->trans("Delete").'
'; } else { - print ''.$langs->trans("Delete").''; + print '
'.$langs->trans("Delete").'
'; } } else { - print ''.$langs->trans("Delete").''; + print '
'.$langs->trans("Delete").'
'; } print ""; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 71e0de738fa..dd3f2add4ba 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -615,7 +615,7 @@ if ($resql) $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; - if($user->rights->facture->creer) + if($user->rights->facture->creer && $contextpage != 'poslist') { $newcardbutton.= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/facture/card.php?action=create'); } @@ -697,7 +697,7 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + if ($massactionbutton && $contextpage != 'poslist') $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print ''."\n"; @@ -1094,7 +1094,14 @@ if ($resql) if (! empty($arrayfields['s.nom']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } @@ -1261,7 +1268,7 @@ if ($resql) // Action column print ''; } +if (! empty($arrayfields['p.jabberid']['checked'])) +{ + print ''; +} if (! empty($arrayfields['p.twitter']['checked'])) { print ''; } // Ref supplier if (! empty($arrayfields['f.ref_supplier']['checked'])) { print ''; } // Type @@ -622,7 +622,7 @@ if ($resql) if (! empty($arrayfields['f.label']['checked'])) { print ''; } // Date invoice @@ -647,17 +647,17 @@ if ($resql) // Project if (! empty($arrayfields['p.ref']['checked'])) { - print ''; + print ''; } // Thirpdarty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; } // Town - if (! empty($arrayfields['s.town']['checked'])) print ''; + if (! empty($arrayfields['s.town']['checked'])) print ''; // Zip - if (! empty($arrayfields['s.zip']['checked'])) print ''; + if (! empty($arrayfields['s.zip']['checked'])) print ''; // State if (! empty($arrayfields['state.nom']['checked'])) { @@ -688,35 +688,35 @@ if ($resql) } if (! empty($arrayfields['f.total_ht']['checked'])) { - // Amount + // Amount without tax print ''; } if (! empty($arrayfields['f.total_vat']['checked'])) { - // Amount + // Amount vat print ''; } if (! empty($arrayfields['f.total_localtax1']['checked'])) { - // Amount + // Amount tax 1 print ''; } if (! empty($arrayfields['f.total_localtax2']['checked'])) { - // Amount + // Amount tax 2 print ''; } if (! empty($arrayfields['f.total_ttc']['checked'])) { - // Amount + // Amount inc tac print ''; @@ -776,7 +776,7 @@ if ($resql) if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], 's.nom', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); @@ -820,6 +820,7 @@ if ($resql) $facturestatic->date_echeance = $db->jdate($obj->datelimite); $facturestatic->statut = $obj->fk_statut; + $thirdparty->id=$obj->socid; $thirdparty->name=$obj->name; $thirdparty->client=$obj->client; @@ -837,6 +838,14 @@ if ($resql) $totalpay = $paiement + $totalcreditnotes + $totaldeposits; $remaintopay = $obj->total_ttc - $totalpay; + //If invoice has been converted and the conversion has been used, we dont have remain to pay on invoice + if($facturestatic->type == FactureFournisseur::TYPE_CREDIT_NOTE) { + + if($facturestatic->isCreditNoteUsed()){ + $remaintopay=-$facturestatic->getSumFromThisCreditNotesNotUsed(); + } + } + print ''; if (! empty($arrayfields['f.ref']['checked'])) { @@ -944,7 +953,7 @@ if ($resql) // Zip if (! empty($arrayfields['s.zip']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 616b565496a..dccd53c597a 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -54,6 +54,7 @@ Firstname=First name PostOrFunction=Job position UserTitle=Title NatureOfThirdParty=Nature of Third party +NatureOfContact=Nature of Contact Address=Address State=State/Province StateShort=State diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index e826e86ea57..2ba29aef106 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -179,11 +179,12 @@ if (empty($reshook)) } else { - $object->datestart = $datestart; - $object->dateend = $dateend; - $object->capital = $capital; - $object->nbterm = GETPOST("nbterm", 'int'); - $object->rate = price2num(GETPOST("rate", 'alpha')); + $object->datestart = $datestart; + $object->dateend = $dateend; + $object->capital = $capital; + $object->nbterm = GETPOST("nbterm", 'int'); + $object->rate = price2num(GETPOST("rate", 'alpha')); + $object->insurance_amount = price2num(GETPOST('insurance_amount', 'int')); $accountancy_account_capital = GETPOST('accountancy_account_capital'); $accountancy_account_insurance = GETPOST('accountancy_account_insurance'); @@ -793,25 +794,25 @@ if ($id > 0) { // print ''.$langs->trans('CreateCalcSchedule').''; - print ''.$langs->trans("Modify").''; + print '
'.$langs->trans("Modify").'
'; } // Emit payment if ($object->paid == 0 && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) { - print ''.$langs->trans("DoPayment").''; + print '
'.$langs->trans("DoPayment").'
'; } // Classify 'paid' if ($object->paid == 0 && round($staytopay) <=0 && $user->rights->loan->write) { - print ''.$langs->trans("ClassifyPaid").''; + print '
'.$langs->trans("ClassifyPaid").'
'; } // Delete if ($object->paid == 0 && $user->rights->loan->delete) { - print ''.$langs->trans("Delete").''; + print '
'.$langs->trans("Delete").'
'; } print ""; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 14d9fa2e483..f29ce739b30 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -266,7 +266,7 @@ $sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; -$sql.= " WHERE p.entity IN (".getEntity('project', $conf->entity).")"; +$sql.= " WHERE p.entity IN (".getEntity('project').")"; $sql.= " AND p.fk_statut = 1"; if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; // If we have this test true, it also means projectset is not 2 if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 5028dae747e..31dcd83db91 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -482,16 +482,16 @@ if ($id) { if (! empty($user->rights->salaries->delete)) { - print ''.$langs->trans("Delete").''; + print '
'.$langs->trans("Delete").'
'; } else { - print ''.$langs->trans("Delete").''; + print '
'.$langs->trans("Delete").'
'; } } else { - print ''.$langs->trans("Delete").''; + print '
'.$langs->trans("Delete").'
'; } print ""; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 01770e1bee1..c8c9e2e9fc6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3884,7 +3884,7 @@ class Societe extends CommonObject $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); */ - if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; + if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, type, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; $sql .= " WHERE fk_soc = ". $this->id; if ($mode == 'supplier') { @@ -3911,7 +3911,11 @@ class Societe extends CommonObject $tmpobject=new Facture($this->db); } while($obj=$this->db->fetch_object($resql)) { - $tmpobject->id=$obj->rowid; + $tmpobject->id=$obj->rowid; + + + + if ($obj->fk_statut != 0 // Not a draft && ! ($obj->fk_statut == 3 && $obj->close_code == 'replaced') // Not a replaced invoice ) @@ -3928,8 +3932,14 @@ class Societe extends CommonObject $paiement = $tmpobject->getSommePaiement(); $creditnotes = $tmpobject->getSumCreditNotesUsed(); $deposits = $tmpobject->getSumDepositsUsed(); + $outstandingOpened+=$obj->total_ttc - $paiement - $creditnotes - $deposits; } + + //if credit note is converted but not used + if($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed())$outstandingOpened-=$tmpobject->getSumFromThisCreditNotesNotUsed(); + + } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 2ab86d454f0..f69c92da51a 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -199,7 +199,7 @@ $arrayfields=array( 's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5), 's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6), 's.tva_intra'=>array('label'=>"VATIntraShort", 'checked'=>0), - 'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1), + 'customerorsupplier'=>array('label'=>'NatureOfThirdParty', 'checked'=>1), 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel), 's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm), 's2.nom'=>array('label'=>'ParentCompany', 'checked'=>0), @@ -670,7 +670,7 @@ if ($moreforfilter) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); +if ($massactionbutton && $contextpage != 'poslist') $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); if (empty($arrayfields['customerorsupplier']['checked'])) print ''; @@ -1288,7 +1288,7 @@ while ($i < min($num, $limit)) // Action column print ''; print ''; - print ''; + print ''; } print "\n"; @@ -567,7 +567,7 @@ if ($_SESSION["basiclayout"]==1) $htmlforlines.= ''; print $htmlforlines; } - + if ($mobilepage=="products") { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -591,7 +591,7 @@ if ($_SESSION["basiclayout"]==1) $htmlforlines.= ''; print $htmlforlines; } - + if ($mobilepage=="places") { $sql="SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables";
'; - print $thirdpartystatic->getNomUrl(1, 'customer'); + if ($contextpage == 'poslist') + { + print $thirdpartystatic->name; + } + else + { + print $thirdpartystatic->getNomUrl(1, 'customer'); + } print ''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (($massactionbutton || $massaction) && $contextpage != 'poslist') // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; if (in_array($obj->id, $arrayofselected)) $selected=1; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 30c31109224..ce36be991d2 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -539,7 +539,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $sql = 'SELECT f.rowid as facid, f.ref, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,'; $sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql.= ' WHERE f.entity IN ('.getEntity('invoice', $conf->entity).')'; + $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; $sql.= ' AND (f.fk_soc = '.$facture->socid; // Can pay invoices of all child of parent company if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) { diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 0318efb7e1a..9e68e6e79a3 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -710,37 +710,37 @@ if ($id > 0) // Reopen if ($object->paye && $user->rights->tax->charges->creer) { - print "id&action=reopen\">".$langs->trans("ReOpen").""; + print ""; } // Edit if ($object->paye == 0 && $user->rights->tax->charges->creer) { - print "id&action=edit\">".$langs->trans("Modify").""; + print ""; } // Emit payment if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer) { - print "id&action=create\">".$langs->trans("DoPayment").""; + print ""; } // Classify 'paid' if ($object->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer) { - print "id&action=paid\">".$langs->trans("ClassifyPaid").""; + print ""; } // Clone if ($user->rights->tax->charges->creer) { - print "id&action=clone\">".$langs->trans("ToClone").""; + print ""; } // Delete if ($user->rights->tax->charges->supprimer) { - print "id&action=delete\">".$langs->trans("Delete").""; + print ""; } print ""; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 4fd157de9e6..c3914ae79db 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -317,7 +317,7 @@ class ChargeSociales extends CommonObject $sql.= ", date_ech='".$this->db->idate($this->date_ech)."'"; $sql.= ", periode='".$this->db->idate($this->periode)."'"; $sql.= ", amount='".price2num($this->amount, 'MT')."'"; - $sql.= ", fk_projet=".($this->fk_project > 0 ? $this->fk_project : null); + $sql.= ", fk_projet=".($this->fk_project>0?$this->db->escape($this->fk_project):"NULL"); $sql.= ", fk_user_modif=".$user->id; $sql.= " WHERE rowid=".$this->id; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index be738b374cf..759ed75df5e 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -385,16 +385,16 @@ if ($id) { if (! empty($user->rights->tax->charges->supprimer)) { - print ''.$langs->trans("Delete").''; + print ''; } else { - print ''.$langs->trans("Delete").''; + print ''; } } else { - print ''.$langs->trans("Delete").''; + print ''; } print ""; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index fa26c5ed30b..b0db8b0affb 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -165,8 +165,8 @@ $arrayfields=array( 'p.fax'=>array('label'=>"Fax", 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'checked'=>1), 'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))), - 'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), + 'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.linkedin'=>array('label'=>"LinkedIn", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), @@ -427,7 +427,7 @@ if ($search_societe != '') $param.='&search_societe='.urlencode($search_soci if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); if ($search_town != '') $param.='&search_town='.urlencode($search_town); if ($search_country != '') $param.= "&search_country=".urlencode($search_country); -if ($search_job != '') $param.='&search_job='.urlencode($search_job); +if ($search_poste != '') $param.='&search_poste='.urlencode($search_poste); if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro); if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso); if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile); @@ -629,6 +629,12 @@ if (! empty($arrayfields['p.skype']['checked'])) print ''; print ''; + print ''; + print ''; @@ -720,6 +726,7 @@ if (! empty($arrayfields['p.fax']['checked'])) print_liste_field if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['p.jabberid']['checked'])) print_liste_field_titre($arrayfields['p.jabberid']['label'], $_SERVER["PHP_SELF"], "p.jabberid", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.linkedin']['checked'])) print_liste_field_titre($arrayfields['p.linkedin']['label'], $_SERVER["PHP_SELF"], "p.linkedin", $begin, $param, '', $sortfield, $sortorder); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 9dd49ea8864..86ef739d63e 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -195,6 +195,29 @@ abstract class CommonInvoice extends CommonObject } } + /** + * Return amount (with tax) of all converted amount for this credit note + * + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return int <0 if KO, Sum of credit notes and deposits amount otherwise + */ + function getSumFromThisCreditNotesNotUsed($multicurrency=0) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + + $discountstatic=new DiscountAbsolute($this->db); + $result=$discountstatic->getSumFromThisCreditNotesNotUsed($this, $multicurrency); + if ($result >= 0) + { + return $result; + } + else + { + $this->error=$discountstatic->error; + return -1; + } + } + /** * Renvoie tableau des ids de facture avoir issus de la facture * diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 678cfe446a0..cb2ad44b90c 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -629,6 +629,49 @@ class DiscountAbsolute return -1; } } + /** + * Return amount (with tax) of all converted amount for this credit note + * + * @param CommonInvoice $invoice Object invoice + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return int <0 if KO, Sum of credit notes and deposits amount otherwise + */ + function getSumFromThisCreditNotesNotUsed($invoice, $multicurrency=0) + { + dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); + + if ($invoice->element == 'facture' || $invoice->element == 'invoice') + { + $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc'; + $sql.= ' WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = '.$invoice->id; + } + else if ($invoice->element == 'invoice_supplier') + { + $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc'; + $sql.= ' WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = '.$invoice->id; + } + else + { + $this->error=get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; + dol_print_error($this->error); + return -1; + } + + $resql=$this->db->query($sql); + if ($resql) + { + $obj = $this->db->fetch_object($resql); + if ($multicurrency) return $obj->multicurrency_amount; + else return $obj->amount; + } + else + { + $this->error = $this->db->lasterror(); + return -1; + } + } /** * Return clickable ref of object (with picto or not) diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php index cf2c2418092..a32223105b9 100644 --- a/htdocs/core/modules/oauth/stripelive_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/modules/oauth/stripe_oauthcallback.php + * \file htdocs/core/modules/oauth/stripelive_oauthcallback.php * \ingroup oauth * \brief Page to get oauth callback */ @@ -45,7 +45,7 @@ $backtourl = GETPOST('backtourl', 'alpha'); $uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); //$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); //$currentUri->setQuery(''); -$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php'); +$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php'); /** @@ -65,7 +65,7 @@ $storage = new DoliStorage($db, $conf); // Setup the credentials for the requests $credentials = new Credentials( - $conf->global->OAUTH_STRIPE_TEST_ID, + $conf->global->OAUTH_STRIPE_LIVE_ID, $conf->global->STRIPE_LIVE_SECRET_KEY, $currentUri->getAbsoluteUri() ); diff --git a/htdocs/core/modules/oauth/stripetest_oauthcallback.php b/htdocs/core/modules/oauth/stripetest_oauthcallback.php index eb7463749ae..55b532f231c 100644 --- a/htdocs/core/modules/oauth/stripetest_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripetest_oauthcallback.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/modules/oauth/stripe_oauthcallback.php + * \file htdocs/core/modules/oauth/stripetest_oauthcallback.php * \ingroup oauth * \brief Page to get oauth callback */ @@ -45,7 +45,7 @@ $backtourl = GETPOST('backtourl', 'alpha'); $uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); //$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); //$currentUri->setQuery(''); -$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php'); +$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php'); /** diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 3830e2bc31a..14534b3472e 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -69,7 +69,7 @@ $userstatic=new User($db); if ($permission) { ?>
-
trans("Nature"); ?>
+
trans("NatureOfContact"); ?>
trans("ThirdParty"); ?>
trans("Users").'/'.$langs->trans("Contacts"); ?>
trans("ContactType"); ?>
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b1c623bb0f0..a3e6666f412 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2680,6 +2680,27 @@ class FactureFournisseur extends CommonInvoice return ($this->statut == self::STATUS_VALIDATED) && ($this->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)); } + + /** + * Is credit note used + * + * @return bool + */ + public function isCreditNoteUsed() + { + global $db; + + $isUsed = false; + + $sql = "SELECT fk_invoice_supplier FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_invoice_supplier_source=".$this->id; + $resql = $db->query($sql); + if(!empty($resql)){ + $obj = $db->fetch_object($resql); + if(!empty($obj->fk_invoice_supplier))$isUsed=true; + } + + return $isUsed; + } } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index b18af4c3f19..c8a5ab2fec7 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2013-2019 Philippe Grand * Copyright (C) 2013 Florian Henry @@ -588,14 +588,14 @@ if ($resql) if (! empty($arrayfields['f.ref']['checked'])) { print '
'; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
'; + print ''; print $obj->zip; print ''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (($massactionbutton || $massaction) && $contextpage != 'poslist') // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; if (in_array($obj->rowid, $arrayofselected)) $selected=1; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 663c7d4d006..b8161da749c 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; -$langs->loadLangs(array("bills", "cashdesk")); +$langs->loadLangs(array("companies", "commercial", "bills", "cashdesk")); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); @@ -175,7 +175,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->datepaye = $now; $payment->fk_account = $bankaccount; $payment->amounts[$invoice->id] = $amountofpayment; - + // If user has not used change control, add total invoice payment if ($amountofpayment == 0) $payment->amounts[$invoice->id] = $invoice->total_ttc; @@ -395,7 +395,7 @@ if ($action=="valid" || $action=="history") } else { - if ($invoice->paye) $sectionwithinvoicelink.=''.$langs->trans("Payed").''; + if ($invoice->paye) $sectionwithinvoicelink.=''.$langs->trans("Paid").''; else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated'); } $sectionwithinvoicelink.=''; @@ -541,7 +541,7 @@ if ($_SESSION["basiclayout"]!=1) { print '' . $langs->trans('ReductionShort') . '' . $langs->trans('Qty') . '' . $langs->trans('TotalHTShort') . '' . $langs->trans('TotalTTCShort') . '