diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 46a11e363fd..0764f86dfb1 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -78,7 +78,7 @@ if ($action == 'updateMask') } } -if ($action == 'specimen') +else if ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -164,7 +164,7 @@ else if ($action == 'setmod') dolibarr_set_const($db, "FACTURE_ADDON",$value,'chaine',0,'',$conf->entity); } -if ($action == 'setribchq') +else if ($action == 'setribchq') { $rib = GETPOST('rib','alpha'); $chq = GETPOST('chq','alpha'); @@ -184,7 +184,7 @@ if ($action == 'setribchq') } } -if ($action == 'set_FACTURE_DRAFT_WATERMARK') +else if ($action == 'set_FACTURE_DRAFT_WATERMARK') { $draft = GETPOST('FACTURE_DRAFT_WATERMARK','alpha'); @@ -202,7 +202,7 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK') } } -if ($action == 'set_INVOICE_FREE_TEXT') +else if ($action == 'set_INVOICE_FREE_TEXT') { $freetext = GETPOST('INVOICE_FREE_TEXT','none'); // No alpha here, we want exact string @@ -220,7 +220,7 @@ if ($action == 'set_INVOICE_FREE_TEXT') } } -if ($action == 'setforcedate') +else if ($action == 'setforcedate') { $forcedate = GETPOST('forcedate','alpha'); @@ -238,20 +238,20 @@ if ($action == 'setforcedate') } } -if ($action == 'setDefaultPDFModulesByType') +else if ($action == 'setDefaultPDFModulesByType') { $invoicetypemodels = GETPOST('invoicetypemodels'); - + if(!empty($invoicetypemodels) && is_array($invoicetypemodels)) { $error = 0; - + foreach ($invoicetypemodels as $type => $value) { $res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type),$value,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; } - + if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -621,7 +621,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf print ''.$langs->trans("Name").''; print ''; print "\n"; - + $listtype=array( Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), @@ -632,7 +632,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf { $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); } - + foreach ($listtype as $type => $trans) { $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; @@ -642,7 +642,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf print ''.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current,0,0, 0).''; print "\n"; } - + print ''; print ""; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index cf860cd64ba..81fdd4d534e 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -70,7 +70,7 @@ if ($action == 'updateMask') } } -if ($action == 'specimen') +else if ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -115,7 +115,27 @@ if ($action == 'specimen') } } -if ($action == 'set_PROPALE_DRAFT_WATERMARK') +else if ($action == 'setribchq') +{ + $rib = GETPOST('rib','alpha'); + $chq = GETPOST('chq','alpha'); + + $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$rib,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$chq,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +else if ($action == 'set_PROPALE_DRAFT_WATERMARK') { $draft = GETPOST('PROPALE_DRAFT_WATERMARK','alpha'); @@ -132,7 +152,7 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK') } } -if ($action == 'set_PROPOSAL_FREE_TEXT') +else if ($action == 'set_PROPOSAL_FREE_TEXT') { $freetext = GETPOST('PROPOSAL_FREE_TEXT','none'); // No alpha here, we want exact string @@ -150,7 +170,7 @@ if ($action == 'set_PROPOSAL_FREE_TEXT') } } -if ($action == 'setdefaultduration') +else if ($action == 'setdefaultduration') { $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION",$value,'chaine',0,'',$conf->entity); @@ -166,7 +186,7 @@ if ($action == 'setdefaultduration') } } -if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') +else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') { $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity); @@ -183,7 +203,7 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') } // Activate a model -if ($action == 'set') +else if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } @@ -499,6 +519,106 @@ foreach ($dirmodels as $reldir) } print ''; + +/* + * Payment mode + */ +if (! empty($conf->banque->enabled) && empty($conf->facture->enabled)) +{ + print '
'; + print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"),'',''); + + print '
'; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print "\n"; + + print ''; + print ""; + print ""; + + print ''; + print ""; + print ""; + print "
'; + print ''; + print $langs->trans("PaymentMode").'
".$langs->trans("SuggestPaymentByRIBOnAccount").""; + if (! empty($conf->banque->enabled)) + { + $sql = "SELECT rowid, label"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; + $sql.= " WHERE clos = 0"; + $sql.= " AND courant = 1"; + $sql.= " AND entity IN (".getEntity('bank_account').")"; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + if ($num > 0) + { + print '"; + } + else + { + print "".$langs->trans("NoActiveBankAccountDefined").""; + } + } + } + else + { + print $langs->trans("BankModuleNotActive"); + } + print "
".$langs->trans("SuggestPaymentByChequeToAddress").""; + print '"; + print "
"; + print "
"; +} + print '
';