Accélérer navigation dans dolibarr

Variables globales

configuration > divers

ADHERENT_DEFAULT_SENDINFOBYMAIL=true 
MAIN_AUTOFILL_DATE=true
MAIN_MENU_HIDE_UNAUTHORIZED=true

Personnalisation de messages

htdocs/htdocs/langs/fr_FR/other.lang

permet de modifier les messages d'envoi des factures/commandes/etc…

Lien vers fiche Client au lieu de sa Fiche

  • Dans la page Tiers pour remplacer le lien vers l'onglet “Fiche” d'un Tiers, par le lien vers l'onglet “Client” dans le tableau des derniers tiers modifiés et ajouter un lien de création de commande direct. remplacer dans le fichier htdocs/societe/index.php vers la ligne 300 :
                print $thirdparty_static->getNomUrl(1);

par

            if ($thirdparty_static->client==1 || $thirdparty_static->client==3)
            {
                    print $thirdparty_static->getNomUrl(0,'customer',0,1);
                    print '<td><a href="https://YOURDOMAIN/DOLIPATH/commande/card.php?socid='.$thirdparty_static->id.'&action=create">Creer commande</a></td>'."\n";
            }
            else
            {
                    print $thirdparty_static->getNomUrl(1);
                    print "<td></td>\n";
            }
  • Recherche de Tiers. Modifier htdocs/societe/list.php vers la ligne 420

remplacer

         print $companystatic->getNomUrl(1,'',100);

par

        if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
        {
            print $companystatic->getNomUrl(0,'customer');
        }

~ ligne 500 htdoc/comm/card.php

ajouter la visu de l'état de la cotisation dans le If du module adhérent :

 // Status
         print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';

ajouter notification en cas de cotisation non à jour vers la ligne 980

             //modif antho
 
<!--             echo '<script type="text/javascript">
             var TESTADH="'.$adh->getLibStatut(1).'";
             if ( TESTADH.match(/^No.*/)  ){
                 var RALERTADH = confirm("Adhérent Non à jour - Voulez vous mettre à jour la cotisation");
             if ( RALERTADH == true ) {
                     window.location.href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$adh->id.'&action=addsubscription";
                     //window.open("'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$adh->id.'","_blank"); 
                }
             }
             </script>';-->
 
        $today=dol_now();
                $adh_tolerance_info=dol_time_plus_duree($today,2,'m');
        echo '<script type="text/javascript">
          var TESTADH="'.$adh->getLibStatut(1).'";
          var EMAIL="'.$adh->email.'";
          var TOL_INFO='.$adh_tolerance_info.';
          var DATEFIN='.$adh->datefin.' ;
          if ( TESTADH.match(/^No.*/)  ){
               var RALERTADH = confirm("Adhérent Non à jour - Voulez vous mettre à jour la cotisation\n\n'
.$extra_alert_message.'\n'.
'\n  Mail           : '.$adh->email.
'\n  Tel pro       : '.$adh->phone.
'\n  Tel perso   : '.$adh->phone_perso.
'\n  Tel mobile : '.$adh->phone_mobile.
'");
               if ( RALERTADH == true ) {
                   window.location.href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$adh->id.'&action=addsubscription";
                   //window.open("'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$adh->id.'","_blank"); 
               }
           }
          else if ( TOL_INFO > DATEFIN ){
               var RALERTADH = confirm("Fin de validité de l\'adhésion dans moins de 2 mois - Voulez vous mettre à jour la cotisation\n\n'
.$extra_alert_message.'\n'.
'\n  Mail           : '.$adh->email.
'\n  Tel pro       : '.$adh->phone.
'\n  Tel perso   : '.$adh->phone_perso.
'\n  Tel mobile : '.$adh->phone_mobile.
'");
               if ( RALERTADH == true ) {
                   window.location.href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$adh->id.'&action=addsubscription";
                   //window.open("'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$adh->id.'","_blank"); 
               }
 
          }
          else if ( !EMAIL || 0 === EMAIL.length ){
               var ALERTADHEMAIL = confirm("Email de l\'adhérent non renseigné !\nUn email est important pour recevoir notifications de factures et newsletters\n Mettre à jour ?\n\n");
                if ( ALERTADHEMAIL == true ) {
                    window.location.href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$adh->id.'&action=edit";
                }
           }
           </script>';

Création d'Adhérent

Modifier le fichier htdocs/adherent/fiche

valeur “Physique” par défaut pour le champ “Nature” : remplacer ~ ligne 780

        print $form->selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1);

par

        print $form->selectarray("morphy", $morphys, "phy", 1);

valeur “Membre” par défaut pour le champ “Type” : remplacer ~ ligne 790

print $form->selectarray("typeid", $listetype, GETPOST('typeid','int')?GETPOST('typeid','int'):$typeid, count($listetype)>1?1:0);

par

print $form->selectarray("typeid", $listetype, 2, count($listetype)>1?1:0);

Adhérents

configurations>divers ajouter variable

ADHERENT_DEFAULT_SENDINFOBYMAIL true

pour notifier des cotisations

Cotisations

Sélection du compte en fonction du moyen de paiement

modifier htdocs/adherents/card_subscriptions ligne 905, en y ajoutant l'appel à la fonction checkcount()

print '<form name="cotisation" method="POST" action="'.$_SERVER["PHP_SELF"].'" onchange="checkcount()">';

et ajouter la fonction après

print '
<script type="text/javascript">
function checkcount() {
    var moyen_payment = document.getElementById("selectoperation").value
    f ( moyen_payment == ""){
        document.getElementById("selectaccountid").value = "-1"
    }
    else if (moyen_payment == "LIQ"){
        //caisse
        document.getElementById("selectaccountid").value = "2"
    }
    else{
         //credi coop
         document.getElementById("selectaccountid").value = "1"
    }
}
</script>';

Mettre également la ligne du tableau “Payment Mode” avant “Bank Account” vers la ligne 1049

                // Payment mode
                print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
                $form->select_types_paiements(GETPOST('operation'),'operation','',2);
                print "</td></tr>\n";
 
                // Bank account
                print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
                $form->select_comptes(GETPOST('accountid'),'accountid',0,'',1);
                print "</td></tr>\n";

Mise à jour automatique de la date de fin d'adhésion

vers la ligne 954 de htdocs/adherents/card_subscriptions.php

// Date end subscription
        if (GETPOST('endday'))
        {
            $dateto=dol_mktime(0,0,0,GETPOST('endmonth'),GETPOST('endday'),GETPOST('endyear'));
        }
        if (! $dateto)
        {
            //$dateto=-1;       // By default, no date is suggested
            if ( $today > $datefrom ){
               $endyear=dol_time_plus_duree($today,1,'y');
            }
            else{
               $endyear=dol_time_plus_duree($datefrom,1,'y');
            }
            $infodateto=getdate($endyear);            
            $dateto=dol_mktime(0,0,1,$infodateto['mon'],$infodateto['mday'],$infodateto['year']);
        }

Commandes

Pré-remplissage de la note publique

Ajout de quelques infos dans la note publique pour rappeler de mettre la description de l'ordinateur et du problème. Fichier à modifier htdocs/commande/card.php :

 $doleditor = new DolEditor('note_public', $note_public."<b>Description ordinateur :</b><br/><b>Problème :</b>", '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');

Afficher note publique sur fiche commande

1 - faire une copie de htdocs/core/tpl/notes.tpd.php > htdocs/core/tpl/notes_public.tpd.php 2 - supprimer la partie note privée de notes_public.tpd.php 3 - ajouter après le tableau des données de la commande ( chercher “Statut” )

        include DOL_DOCUMENT_ROOT.'/core/tpl/notes_public.tpl.php';

Il est également possible de modifier la variable globale MAIN_DISABLE_NOTES_TAB pour faire apparaître un menu déroulant affichant notes publiques et notes privées. bloc information

Factures

Afficher note publique sur fiche commande

modifier htdocs/compta/facture.php ligne ( après le bloc “Other attributes” ~ ligne 3475)

        include DOL_DOCUMENT_ROOT.'/core/tpl/notes_public.tpl.php';

Sélection du compte en fonction du moyen de paiement

modifier htdocs/compta/facture.php ligne 1921

print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';

en y ajoutant l'appel à une fonction de check

print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST" onchange="checkcount()">';
 
print '
<script type="text/javascript">
function checkcount() {
    var moyen_payment = document.getElementById("selectmode_reglement_id").value
    if (moyen_payment == "0"){
        document.getElementById("selectfk_account").value = "-1"
    }    
    else if (moyen_payment == "4"){
        document.getElementById("selectfk_account").value = "2"
    }
    else{
         document.getElementById("selectfk_account").value = "1"
    }
}
</script>';

vérifier les ids correspondant aux mode de paiement (selectmod_reglement_id) et de compte (selectfk_account) pour matcher avant l'introduction de la modification.

Forcer le classement des commandes liées au statut délivrée

vers la ligne 3810 après

$somethingshown = $form->showLinkedObjectBlock($object);

ajouter

        $object->fetchObjectLinked();
        $num = count($object->linkedObjects);
 
        // si un objet est liee et que la facture est payee
        if ( $somethingshown == 1  && $object->statut == 2) { 
 
          foreach($object->linkedObjects['commande'] as $linkedCommand){
             //afficher un popup pour classer la commande delivree apres la facturation
             if( $linkedCommand->statut == 1 ){ 
                 print '<script type="text/javascript">  
                 var DELIVER_COMMAND = confirm("Classer la commande '.$linkedCommand->ref.' comme délivrée");
 
                 if ( DELIVER_COMMAND == true ) {
                     //window.location.href="'.DOL_URL_ROOT.'/commande/card.php?id='.$linkedCommand->id.'&action=shipped";
                     //confirmer directement le classement de la commande + ouvrir dans un nouvel onglet pour rester sur la page facture
                     window.open("'.DOL_URL_ROOT.'/commande/card.php?id='.$linkedCommand->id.'&action=confirm_shipped&confirm=yes","_blank");
 
                   }
                 </script>';
                }    
            }    
         }    

Paiement Facture

htdoc/compta/paiement.php ligne 398

print '<form id=“payment_form” name=“add_paiement” action=“'.$_SERVER[“PHP_SELF”].'” method=“POST” onchange=“checkcount()”>';

print '
<script type="text/javascript">
function checkcount() {
    var moyen_payment = document.getElementById("selectpaiementcode").value
    f ( moyen_payment == ""){
        document.getElementById("selectaccountid").value = "-1"
    }
    else if (moyen_payment == "LIQ"){
        //caisse
        document.getElementById("selectaccountid").value = "2"
    }
    else{
         //credi coop
         document.getElementById("selectaccountid").value = "1"
    }
}
</script>';

ligne 475 Compléter émetteur du chèque

            $showchqemetteur=(GETPOST('chqemetteur'))?GETPOST('chqemetteur'):$facture->client->name;
            print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.$showchqemetteur.'"></td></tr>';

MEMO

Menu ~/gestion/htdocs/core/menus/standard/oblyon.lib.php