コード例 #1
0
 /**
  *  Get object
  *
  *  @param	int		$id		Object id
  *  @return	object			Object loaded
  */
 function getObject($id)
 {
     $ret = $this->getInstanceDao();
     if (is_object($this->object) && method_exists($this->object, 'fetch')) {
         if (!empty($id)) {
             $this->object->fetch($id);
         }
     } else {
         $object = new Adherent($this->db);
         if (!empty($id)) {
             $object->fetch($id);
         }
         $this->object = $object;
     }
 }
コード例 #2
0
ファイル: AdherentTest.php プロジェクト: remyyounes/dolibarr
    /**
     * @depends	testAdherentOther
     * The depends says test is run only if previous is ok
     */
    public function testAdherentDelete($id)
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new Adherent($this->savdb);
    	$result=$localobject->fetch($id);
		$result=$localobject->delete($id);
		print __METHOD__." id=".$id." result=".$result."\n";
		$this->assertLessThan($result, 0);

		return $result;
    }
コード例 #3
0
ファイル: viewcat.php プロジェクト: Samara94/dolibarr
     $elementtype = 'product';
 } else {
     if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) {
         $tmpobject = new Societe($db);
         $result = $tmpobject->fetch($removeelem);
         $elementtype = 'fournisseur';
     } else {
         if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) {
             $tmpobject = new Societe($db);
             $result = $tmpobject->fetch($removeelem);
             $elementtype = 'societe';
         } else {
             if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) {
                 require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
                 $tmpobject = new Adherent($db);
                 $result = $tmpobject->fetch($removeelem);
                 $elementtype = 'member';
             } else {
                 if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
                     require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
                     $tmpobject = new Contact($db);
                     $result = $tmpobject->fetch($removeelem);
                     $elementtype = 'contact';
                 }
             }
         }
     }
 }
 $result = $object->del_type($tmpobject, $elementtype);
 if ($result < 0) {
     dol_print_error('', $object->error);
コード例 #4
0
ファイル: fiche.php プロジェクト: netors/dolibarr
         $objal = $db->fetch_object($resql);
         print $objal->nb ? $objal->nb : $langs->trans("NoOtherDeliveryAddress");
     } else {
         dol_print_error($db);
     }
     print '</td>';
     print '</tr>';
 }
 // Module Adherent
 if ($conf->adherent->enabled) {
     $langs->load("members");
     $langs->load("users");
     print '<tr><td width="25%" valign="top">' . $langs->trans("LinkedToDolibarrMember") . '</td>';
     print '<td colspan="3">';
     $adh = new Adherent($db);
     $result = $adh->fetch('', '', $objsoc->id);
     if ($result > 0) {
         $adh->ref = $adh->getFullName($langs);
         print $adh->getNomUrl(1);
     } else {
         print $langs->trans("UserNotLinkedToMember");
     }
     print '</td>';
     print "</tr>\n";
 }
 print "</table>";
 print "</td>\n";
 print '<td valign="top" width="50%" class="notopnoleftnoright">';
 // Nbre max d'elements des petites listes
 $MAXLIST = 4;
 $tableaushown = 1;
コード例 #5
0
    /**
     *    Assign custom values for canvas (for example into this->tpl to be used by templates)
     *
     *    @param	string	$action    Type of action
     *    @param	string	$id			Id of object
     *    @param	string	$ref		Ref of object
     *    @return	void
     */
    function assign_values(&$action, $id = 0, $ref = '')
    {
        global $conf, $langs, $user, $mysoc, $canvas;
        global $form, $formadmin, $formcompany;
        if ($action == 'add' || $action == 'update') {
            $this->assign_post($action);
        }
        if ($_GET["type"] == 'f') {
            $this->object->fournisseur = 1;
        }
        if ($_GET["type"] == 'c') {
            $this->object->client = 1;
        }
        if ($_GET["type"] == 'p') {
            $this->object->client = 2;
        }
        if ($_GET["type"] == 'cp') {
            $this->object->client = 3;
        }
        if ($_REQUEST["private"] == 1) {
            $this->object->particulier = 1;
        }
        foreach ($this->object as $key => $value) {
            $this->tpl[$key] = $value;
        }
        $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors);
        if (is_array($GLOBALS['errors'])) {
            $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error');
        }
        if ($action == 'create') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selecttype'] = "\n" . '<script type="text/javascript" language="javascript">
				$(document).ready(function () {
		              $("#radiocompany").click(function() {
                            document.formsoc.action.value="create";
                            document.formsoc.canvas.value="company";
                            document.formsoc.private.value=0;
                            document.formsoc.submit();
		              });
		               $("#radioprivate").click(function() {
                            document.formsoc.action.value="create";
                            document.formsoc.canvas.value="individual";
                            document.formsoc.private.value=1;
                            document.formsoc.submit();
                      });
		          });
                </script>' . "\n";
            }
        }
        if ($action == 'create' || $action == 'edit') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript">
				$(document).ready(function () {
						$("#selectcountry_id").change(function() {
							document.formsoc.action.value="' . $action . '";
							document.formsoc.canvas.value="' . $canvas . '";
							document.formsoc.submit();
						});
					})
				</script>' . "\n";
            }
            // Load object modCodeClient
            $module = !empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard';
            if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
                $module = substr($module, 0, dol_strlen($module) - 4);
            }
            $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
            foreach ($dirsociete as $dirroot) {
                $res = dol_include_once($dirroot . $module . '.php');
                if ($res) {
                    break;
                }
            }
            $modCodeClient = new $module($db);
            $this->tpl['auto_customercode'] = $modCodeClient->code_auto;
            // We verified if the tag prefix is used
            if ($modCodeClient->code_auto) {
                $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
            }
            // TODO create a function
            $this->tpl['select_customertype'] = '<select class="flat" name="client">';
            $this->tpl['select_customertype'] .= '<option value="2"' . ($this->object->client == 2 ? ' selected="selected"' : '') . '>' . $langs->trans('Prospect') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="3"' . ($this->object->client == 3 ? ' selected="selected"' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="1"' . ($this->object->client == 1 ? ' selected="selected"' : '') . '>' . $langs->trans('Customer') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="0"' . ($this->object->client == 0 ? ' selected="selected"' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
            $this->tpl['select_customertype'] .= '</select>';
            // Customer
            $this->tpl['customercode'] = $this->object->code_client;
            if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) {
                $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0);
            }
            $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable();
            $s = $modCodeClient->getToolTip($langs, $this->object, 0);
            $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1);
            if (!empty($conf->fournisseur->enabled)) {
                $this->tpl['supplier_enabled'] = 1;
                // Load object modCodeFournisseur
                $module = $conf->global->SOCIETE_CODECLIENT_ADDON;
                if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
                    $module = substr($module, 0, dol_strlen($module) - 4);
                }
                $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
                foreach ($dirsociete as $dirroot) {
                    $res = dol_include_once($dirroot . $module . '.php');
                    if ($res) {
                        break;
                    }
                }
                $modCodeFournisseur = new $module();
                $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto;
                // We verified if the tag prefix is used
                if ($modCodeFournisseur->code_auto) {
                    $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
                }
                // Supplier
                $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1);
                $this->tpl['suppliercode'] = $this->object->code_fournisseur;
                if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) {
                    $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1);
                }
                $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable();
                $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1);
                $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1);
                $this->object->LoadSupplierCateg();
                $this->tpl['suppliercategory'] = $this->object->SupplierCategories;
            }
            // Zip
            $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
            // Town
            $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
            // Country
            $this->object->country_id = $this->object->country_id ? $this->object->country_id : $mysoc->country_id;
            $this->object->country_code = $this->object->country_code ? $this->object->country_code : $mysoc->country_code;
            $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
            $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')';
            if ($user->admin) {
                $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
            }
            // State
            if ($this->object->country_id) {
                $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
            } else {
                $this->tpl['select_state'] = $countrynotdefined;
            }
            // Language
            if (!empty($conf->global->MAIN_MULTILANGS)) {
                $this->tpl['select_lang'] = $formadmin->select_language($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT, 'default_lang', 0, 0, 1);
            }
            // VAT
            $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1);
            // Assujeti par defaut en creation
            // Select users
            $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1);
            // Local Tax
            // TODO mettre dans une classe propre au pays
            if ($mysoc->country_code == 'ES') {
                $this->tpl['localtax'] = '';
                if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td>';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td>';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td></tr>';
                } elseif ($mysoc->localtax1_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td colspan="3">';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><tr>';
                } elseif ($mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td colspan="3">';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><tr>';
                }
            }
        } else {
            $head = societe_prepare_head($this->object);
            $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company');
            $this->tpl['showend'] = dol_get_fiche_end();
            $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', $user->societe_id ? 0 : 1, 'rowid', 'nom');
            $this->tpl['checkcustomercode'] = $this->object->check_codeclient();
            $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
            $this->tpl['address'] = dol_nl2br($this->object->address);
            $img = picto_from_langcode($this->object->country_code);
            if ($this->object->isInEEC()) {
                $this->tpl['country'] = $form->textwithpicto(($img ? $img . ' ' : '') . $this->object->country, $langs->trans("CountryIsInEEC"), 1, 0);
            }
            $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country;
            $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX');
            $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
            $this->tpl['url'] = dol_print_url($this->object->url);
            $this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
            // Third party type
            $arr = $formcompany->typent_array(1);
            $this->tpl['typent'] = $arr[$this->object->typent_code];
            if (!empty($conf->global->MAIN_MULTILANGS)) {
                require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
                //$s=picto_from_langcode($this->default_lang);
                //print ($s?$s.' ':'');
                $langs->load("languages");
                $this->tpl['default_lang'] = $this->default_lang ? $langs->trans('Language_' . $this->object->default_lang) : '';
            }
            $this->tpl['image_edit'] = img_edit();
            $this->tpl['display_rib'] = $this->object->display_rib();
            // Sales representatives
            $this->tpl['sales_representatives'] = '';
            $listsalesrepresentatives = $this->object->getSalesRepresentatives($user);
            $nbofsalesrepresentative = count($listsalesrepresentatives);
            if ($nbofsalesrepresentative > 3) {
                $this->tpl['sales_representatives'] .= '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $this->object->id . '">';
                $this->tpl['sales_representatives'] .= $nbofsalesrepresentative;
                $this->tpl['sales_representatives'] .= '</a>';
            } else {
                if ($nbofsalesrepresentative > 0) {
                    $userstatic = new User($this->db);
                    $i = 0;
                    foreach ($listsalesrepresentatives as $val) {
                        $userstatic->id = $val['id'];
                        $userstatic->lastname = $val['name'];
                        $userstatic->firstname = $val['firstname'];
                        $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1);
                        $i++;
                        if ($i < $nbofsalesrepresentative) {
                            $this->tpl['sales_representatives'] .= ', ';
                        }
                    }
                } else {
                    $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected");
                }
            }
            // Linked member
            if (!empty($conf->adherent->enabled)) {
                $langs->load("members");
                $adh = new Adherent($this->db);
                $result = $adh->fetch('', '', $this->object->id);
                if ($result > 0) {
                    $adh->ref = $adh->getFullName($langs);
                    $this->tpl['linked_member'] = $adh->getNomUrl(1);
                } else {
                    $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember");
                }
            }
            // Local Tax
            // TODO mettre dans une classe propre au pays
            if ($mysoc->country_code == 'ES') {
                $this->tpl['localtax'] = '';
                if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax1_assuj) . '</td>';
                    $this->tpl['localtax'] .= '<td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax2_assuj) . '</td></tr>';
                } elseif ($mysoc->localtax1_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax1_assuj) . '</td></tr>';
                } elseif ($mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax2_assuj) . '</td></tr>';
                }
            }
        }
    }
コード例 #6
0
ファイル: agenda.php プロジェクト: Samara94/dolibarr
 *  \file       htdocs/adherents/agenda.php
 *  \ingroup    member
 *  \brief      Page of members events
 */
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
$langs->load("companies");
$langs->load("members");
$id = GETPOST('id', 'int');
// Security check
$result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db);
$result = $object->fetch($id);
if ($result > 0) {
    $object->fetch_thirdparty();
    $adht = new AdherentType($db);
    $result = $adht->fetch($object->typeid);
}
/*
 *	Actions
 */
// None
/*
 *	View
 */
$contactstatic = new Contact($db);
$form = new Form($db);
/*
コード例 #7
0
ファイル: fiche.php プロジェクト: netors/dolibarr
             print ' / <a href="' . DOL_URL_ROOT . '/contact/fiche.php?id=' . $fuser->contact_id . '">' . img_object($langs->trans("ShowContact"), 'contact') . ' ' . dol_trunc($contact->getFullName($langs), 32) . '</a>';
         }
     } else {
         print $langs->trans("ThisUserIsNot");
     }
     print '</td>';
     print "</tr>\n";
 }
 // Module Adherent
 if ($conf->adherent->enabled) {
     $langs->load("members");
     print '<tr><td width="25%" valign="top">' . $langs->trans("LinkedToDolibarrMember") . '</td>';
     print '<td>';
     if ($fuser->fk_member) {
         $adh = new Adherent($db);
         $adh->fetch($fuser->fk_member);
         $adh->ref = $adh->login;
         // Force to show login instead of id
         print $adh->getNomUrl(1);
     } else {
         print $langs->trans("UserNotLinkedToMember");
     }
     print '</td>';
     print "</tr>\n";
 }
 print '</table>';
 print '<br><center>';
 print '<input value="' . $langs->trans("Save") . '" class="button" type="submit" name="save">';
 print ' &nbsp; ';
 print '<input value="' . $langs->trans("Cancel") . '" class="button" type="submit" name="cancel">';
 print '</center>';
コード例 #8
0
ファイル: card.php プロジェクト: NoisyBoy86/Dolibarr_test
                }
                print ' ('.$langs->trans("UseTypeFieldToChange").')';
                print '</td>';
                print "</tr>\n";
            }

            // Module Adherent
            if (! empty($conf->adherent->enabled))
            {
                $langs->load("members");
                print '<tr><td width="25%">'.$langs->trans("LinkedToDolibarrMember").'</td>';
                print '<td>';
                if ($object->fk_member)
                {
                    $adh=new Adherent($db);
                    $adh->fetch($object->fk_member);
                    $adh->ref=$adh->login;	// Force to show login instead of id
                    print $adh->getNomUrl(1);
                }
                else
                {
                    print $langs->trans("UserNotLinkedToMember");
                }
                print '</td>';
                print "</tr>\n";
            }

            // Multicompany
            // TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !!
            if (! empty($conf->multicompany->enabled) && is_object($mc))
            {
コード例 #9
0
    }
}
/*
 * View
 */
llxHeader('', $langs->trans("SubscriptionCard"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$form = new Form($db);
dol_htmloutput_errors($errmsg);
if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
    /********************************************
     *
     * Fiche en mode edition
     *
     ********************************************/
    $subscription->fetch($rowid);
    $result = $adh->fetch($subscription->fk_adherent);
    /*
     * Affichage onglets
     */
    $h = 0;
    $head = array();
    $head[$h][0] = DOL_URL_ROOT . '/adherents/fiche_subscription.php?rowid=' . $subscription->id;
    $head[$h][1] = $langs->trans("SubscriptionCard");
    $head[$h][2] = 'general';
    $h++;
    $head[$h][0] = DOL_URL_ROOT . '/adherents/info_subscription.php?rowid=' . $subscription->id;
    $head[$h][1] = $langs->trans("Info");
    $head[$h][2] = 'info';
    $h++;
    print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="post">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
コード例 #10
0
ファイル: categorie.php プロジェクト: Albertopf/prueba
     print '</td></tr>';
     print '</table>';
     dol_fiche_end();
     formCategory($db, $product, 0, $socid, $user->rights->produit->creer || $user->rights->service->creer);
 }
 if ($type == Categorie::TYPE_MEMBER) {
     $langs->load("members");
     /*
      *  Category card for member
      */
     require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
     require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
     require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
     // Produit
     $member = new Adherent($db);
     $result = $member->fetch($id, $ref);
     $membert = new AdherentType($db);
     $membert->fetch($member->typeid);
     llxHeader("", "", $langs->trans("Member"));
     $head = member_prepare_head($member);
     $titre = $langs->trans("Member");
     $picto = 'user';
     dol_fiche_head($head, 'category', $titre, 0, $picto);
     $rowspan = 5;
     if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
         $rowspan += 1;
     }
     if (!empty($conf->societe->enabled)) {
         $rowspan++;
     }
     print '<table class="border" width="100%">';
コード例 #11
0
ファイル: ldap.php プロジェクト: Samara94/dolibarr
require_once DOL_DOCUMENT_ROOT . '/core/class/ldap.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
$langs->load("companies");
$langs->load("members");
$langs->load("ldap");
$langs->load("admin");
$rowid = GETPOST('id', 'int');
$action = GETPOST('action');
// Protection
$socid = 0;
if ($user->societe_id > 0) {
    $socid = $user->societe_id;
}
$object = new Adherent($db);
$result = $object->fetch($rowid);
if (!$result) {
    dol_print_error($db, "Failed to get adherent: " . $object->error);
    exit;
}
/*
 * Actions
 */
if ($action == 'dolibarr2ldap') {
    $db->begin();
    $ldap = new Ldap();
    $result = $ldap->connect_bind();
    $info = $object->_load_ldap_info();
    $dn = $object->_load_ldap_dn($info);
    $olddn = $dn;
    // We can say that old dn = dn as we force synchro
コード例 #12
0
 /**
  * \brief Fonction generant le document sur le disque
  * \param agf		Objet document a generer (ou id si ancienne methode)
  * outputlangs	Lang object for output language
  * file		Name of file to generate
  * \return int 1=ok, 0=ko
  */
 function write_file($loyer, $outputlangs, $file, $socid, $courrier)
 {
     global $user, $langs, $conf, $mysoc;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     if (!is_object($loyer)) {
         $id = $loyer;
         $loyer = new Loyer($this->db);
         $ret = $loyer->fetch($id);
     }
     // dol_syslog ( "pdf_quittance::debug loyer=" . var_export ( $loyer, true ) );
     // Definition of $dir and $file
     $dir = $conf->immobilier->dir_output;
     $file = $dir . '/' . $file;
     if (!file_exists($dir)) {
         if (create_exdir($dir) < 0) {
             $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
             return 0;
         }
     }
     if (file_exists($dir)) {
         $pdf = pdf_getInstance($this->format, $this->unit, $this->orientation);
         if (class_exists('TCPDF')) {
             $pdf->setPrintHeader(false);
             $pdf->setPrintFooter(false);
         }
         $pdf->Open();
         $pagenb = 0;
         $pdf->SetTitle($outputlangs->convToOutputCharset($loyer->nom));
         $pdf->SetSubject($outputlangs->transnoentities("Quitance"));
         $pdf->SetCreator("Dolibarr " . DOL_VERSION . ' (Immobilier module)');
         $pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname));
         $pdf->SetKeyWords($outputlangs->convToOutputCharset($loyer->nom) . " " . $outputlangs->transnoentities("Document"));
         if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
             $pdf->SetCompression(false);
         }
         $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
         // Left, Top, Right
         $pdf->SetAutoPageBreak(1, 0);
         // On recupere les infos societe
         $locataire = new Locataire($this->db);
         $result = $locataire->fetch($loyer->locataire_id);
         $proprio = new Adherent($this->db);
         $result = $proprio->fetch($loyer->proprietaire_id);
         $local = new Local($this->db);
         $result = $local->fetch($loyer->local_id);
         $paiement = new Paie($this->db);
         $result = $paiement->fetch_by_loyer($loyer->id);
         if (!empty($loyer->id)) {
             // New page
             $pdf->AddPage();
             $pagenb++;
             $this->_pagehead($pdf, $agf, 1, $outputlangs);
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 9);
             $pdf->MultiCell(0, 3, '', 0, 'J');
             $pdf->SetTextColor(0, 0, 0);
             $posY = $this->marge_haute;
             $posX = $this->marge_gauche;
             // Bloc Owner
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 15);
             $pdf->SetXY($posX, $posY + 3);
             $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset('Bailleur'), 1, 'C');
             $posY = $pdf->getY();
             $pdf->SetXY($posX, $posY);
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 13);
             $this->str = $proprio->getFullName($outputlangs) . "\n";
             $this->str .= $proprio->address . "\n";
             $this->str .= $proprio->zip . ' ' . $proprio->town;
             $this->str .= ' - ' . $proprio->country . "\n\n";
             if ($proprio->phone) {
                 $this->str .= $outputlangs->transnoentities('Téléphone') . ' ' . $proprio->phone . "\n";
             }
             if ($proprio->fax) {
                 $this->str .= $outputlangs->transnoentities('Fax') . ' ' . $proprio->fax . "\n";
             }
             if ($proprio->email) {
                 $this->str .= $outputlangs->transnoentities('EMail') . ' ' . $proprio->email . "\n";
             }
             if ($proprio->url) {
                 $this->str .= $outputlangs->transnoentities('Url') . ' ' . $proprio->url . "\n";
             }
             $pdf->MultiCell(100, 20, $outputlangs->convToOutputCharset($this->str), 1, 'L');
             // Bloc Locataire
             $posX = $this->page_largeur - $this->marge_droite - 100;
             $posY = $pdf->getY() + 10;
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 15);
             $pdf->SetXY($posX, $posY);
             $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset('Locataire Destinataire'), 1, 'C');
             $posY = $pdf->getY();
             $pdf->SetXY($posX, $posY);
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 13);
             $this->str = $locataire->nom . "\n";
             $this->str .= $local->nom . "\n";
             if (!empty($locataire->adresse)) {
                 $this->str .= $locataire->adresse . "\n";
             } else {
                 $this->str .= $local->adresse . "\n";
             }
             $pdf->MultiCell(100, 20, $outputlangs->convToOutputCharset($this->str), 1, 'L');
             // Bloc Quittance de loyer
             $posX = $this->marge_gauche;
             $posY = $pdf->getY() + 10;
             $widthbox = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
             $pdf->SetFont(pdf_getPDFFont($outputlangs), 'B', 15);
             $pdf->SetXY($posX, $posY);
             $pdf->MultiCell($widthbox, 3, $outputlangs->convToOutputCharset('Quittance de loyer'), 1, 'C');
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 13);
             $posY = $pdf->getY();
             $pdf->SetXY($posX, $posY);
             $period = 'Loyer ' . dol_print_date($loyer->periode_du, '%b %Y');
             $pdf->MultiCell($widthbox, 3, $outputlangs->convToOutputCharset($period), 1, 'C');
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 13);
             $posY = $pdf->getY();
             $pdf->SetXY($posX, $posY);
             $numquitance = 'Quittance n°:' . 'ILQ' . $loyer->id;
             $pdf->MultiCell($widthbox, 3, $outputlangs->convToOutputCharset($numquitance), 1, 'R');
             // Sous Bloc Quittance de loyer Gauche
             $posX = $this->marge_gauche;
             $posY = $pdf->getY();
             $widthbox = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 2;
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 12);
             $pdf->SetXY($posX, $posY);
             $text = ' Reçu de :' . $locataire->nom . "\n";
             $text .= "\n";
             $montantpay = 0;
             if (!empty($loyer->paiepartiel)) {
                 $montantpay = $loyer->paiepartiel;
             }
             $text .= ' la somme de :' . $montantpay . '€' . "\n";
             $text .= "\n";
             $dtpaiement = $paiement->date_paiement;
             if (empty($dtpaiement)) {
                 $dtpaiement = $loyer->echeance;
             }
             $text .= ' le :' . dol_print_date($dtpaiement, 'daytext') . "\n";
             $text .= "\n";
             $text .= ' pour loyer et accessoires des locaux sis à :' . "\n";
             $text .= $local->adresse . "\n";
             $text .= "\n";
             $text .= 'en paiement du terme du ' . dol_print_date($loyer->periode_du, 'daytext') . "\n";
             $text .= 'au ' . dol_print_date($loyer->periode_au, 'daytext') . "\n";
             $text .= "\n";
             $text .= 'Fait à ' . $proprio->town . "\n";
             $text .= 'le ' . dol_print_date(dol_now(), 'daytext') . "\n";
             $text .= "\n";
             $pdf->MultiCell($widthbox, 0, $outputlangs->convToOutputCharset($text), 1, 'L');
             $newpoy = $pdf->getY();
             // Sous Bloc Quittance de loyer Droite
             $posX = $widthbox + $this->marge_gauche;
             $widthbox = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 2;
             $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 12);
             $pdf->SetXY($posX, $posY);
             $text = '<table>';
             $text .= '<tr>';
             $text .= '<td colspan="2">';
             $text .= 'Détail :' . "<BR>";
             $text .= ' - Loyer nu :' . $loyer->loy . '€' . "<BR>";
             $text .= ' - Charges / Provisions de Charges :' . $loyer->charges . '€' . "<BR>";
             $text .= "<BR>";
             $text .= 'Montant total du terme :' . $loyer->montant_tot . '€' . "<BR>";
             $text .= '</td>';
             $text .= '</tr>';
             $sql = "SELECT p.rowid, p.loyer_id, date_paiement as dp, p.montant, p.commentaire as type, il.montant_tot as amount";
             $sql .= " FROM " . MAIN_DB_PREFIX . "immo_paie as p";
             $sql .= ", " . MAIN_DB_PREFIX . "immo_loyer as il ";
             $sql .= " WHERE p.loyer_id = " . $loyer->id;
             $sql .= " AND p.loyer_id = il.rowid";
             $sql .= " ORDER BY dp DESC";
             // print $sql;
             dol_syslog(get_class($this) . ':: Paiement sql=' . $sql, LOG_DEBUG);
             $resql = $this->db->query($sql);
             if ($resql) {
                 $num = $this->db->num_rows($resql);
                 $i = 0;
                 $total = 0;
                 $text .= '<tr>';
                 $text .= '<td align="left">' . $langs->trans("Date") . '</td>';
                 $text .= '<td align="right">' . $langs->trans("Amount") . '</td>';
                 $text .= '</tr><br>';
                 $var = True;
                 while ($i < $num) {
                     $objp = $this->db->fetch_object($resql);
                     $text .= '<tr>';
                     $text .= '<td>' . dol_print_date($this->db->jdate($objp->dp), 'day') . "</td>";
                     $text .= '<td align="right">' . price($objp->montant) . ' ' . $langs->trans("Currency" . $conf->currency) . "</td>";
                     $text .= "</tr>";
                     $totalpaye += $objp->montant;
                     $i++;
                 }
                 if ($loyer->paye == 0) {
                     $text .= "<br><tr><td align=\"left\">" . $langs->trans("AlreadyPaid") . " :</td><td align=\"right\">" . price($totalpaye) . " " . $langs->trans("Currency" . $conf->currency) . "</td></tr>";
                     $text .= "<tr><td align=\"left\">" . $langs->trans("AmountExpected") . " :</td><td align=\"right\">" . price($loyer->montant_tot) . " " . $langs->trans("Currency" . $conf->currency) . "</td></tr>";
                     $resteapayer = $loyer->montant_tot - $totalpaye;
                     $text .= "<tr><td align=\"left\">" . $langs->trans("RemainderToPay") . " :</td>";
                     $text .= "<td align=\"right\">" . price($resteapayer, 2) . " " . $langs->trans("Currency" . $conf->currency) . "</td></tr>";
                 }
                 $this->db->free($resql);
             }
             $text .= "</table>";
             $pdf->writeHTMLCell($widthbox, $newpoy - $posY, $posX, $posY, dol_htmlentitiesbr($text), 1);
             // Tableau Loyer et solde
             $sql = "SELECT il.nom, il.solde";
             $sql .= " FROM " . MAIN_DB_PREFIX . "immo_loyer as il ";
             $sql .= " WHERE il.solde<>0 AND paye=0 AND periode_du<'" . $this->db->idate($loyer->periode_du) . "'";
             $sql .= " AND local_id=" . $loyer->local_id . " AND locataire_id=" . $loyer->locataire_id;
             $sql .= " ORDER BY echeance ASC";
             dol_syslog(get_class($this) . ':: loyerAntierieur sql=' . $sql, LOG_DEBUG);
             $resql = $this->db->query($sql);
             if ($resql) {
                 $num = $this->db->num_rows($resql);
                 if ($num > 0) {
                     // Bloc Solde Anterieur
                     $posX = $this->marge_gauche;
                     $posY = $pdf->getY() + ($newpoy - $posY) + 5;
                     $widthbox = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
                     $pdf->SetFont(pdf_getPDFFont($outputlangs), 'B', 15);
                     $pdf->SetXY($posX, $posY);
                     $pdf->MultiCell($widthbox, 3, $outputlangs->convToOutputCharset('Solde Anterieur'), 1, 'C');
                     $text = '<table>';
                     // print $sql;
                     dol_syslog(get_class($this) . ':: loyerAntierieur sql=' . $sql, LOG_DEBUG);
                     $resql = $this->db->query($sql);
                     $i = 0;
                     $total = 0;
                     $var = True;
                     while ($i < $num) {
                         $objp = $this->db->fetch_object($resql);
                         $text .= '<tr>';
                         $text .= '<td>' . $objp->nom . "</td>";
                         $text .= "<td align=\"right\">" . $objp->solde . ' ' . $langs->trans("Currency" . $conf->currency) . "</td>";
                         $text .= "</tr>";
                         $i++;
                     }
                     $this->db->free($resql);
                     $text .= "</table>";
                     $posY = $pdf->getY();
                     $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 13);
                     $pdf->writeHTMLCell($widthbox, 0, $posX, $posY, dol_htmlentitiesbr($text), 1, 1);
                 }
             }
             // Bloc total somme due
             // Tableau total somme due
             $sql = "SELECT SUM(il.solde) as total";
             $sql .= " FROM " . MAIN_DB_PREFIX . "immo_loyer as il ";
             $sql .= " WHERE il.solde<>0 AND paye=0 AND periode_du<='" . $this->db->idate($loyer->periode_du) . "'";
             $sql .= " AND local_id=" . $loyer->local_id . " AND locataire_id=" . $loyer->locataire_id;
             $sql .= " GROUP BY local_id,locataire_id";
             // print $sql;
             dol_syslog(get_class($this) . ':: loyerAntierieur sql=' . $sql, LOG_DEBUG);
             $resql = $this->db->query($sql);
             if ($resql) {
                 $num = $this->db->num_rows($resql);
                 if ($num > 0) {
                     $objp = $this->db->fetch_object($resql);
                     $posX = $this->marge_gauche;
                     $posY = $pdf->getY() + 5;
                     $widthbox = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
                     $pdf->SetFont(pdf_getPDFFont($outputlangs), 'B', 15);
                     $pdf->SetXY($posX, $posY);
                     if ($objp->total > 0) {
                         $title = 'Total somme due';
                     } else {
                         $title = 'Total somme à rembouser';
                     }
                     $pdf->MultiCell($widthbox, 3, $outputlangs->convToOutputCharset($title), 1, 'C');
                     $text = '<table>';
                     $i = 0;
                     $total = 0;
                     $text .= '<tr>';
                     $text .= "<td align=\"right\">" . $objp->total . ' ' . $langs->trans("Currency" . $conf->currency) . "</td></tr>";
                     $this->db->free($resql);
                     $text .= "</table>";
                     $posY = $pdf->getY();
                     $pdf->SetFont(pdf_getPDFFont($outputlangs), '', 13);
                     $pdf->writeHTMLCell($widthbox, 0, $posX, $posY, dol_htmlentitiesbr($text), 1);
                 }
             }
         }
         $pdf->Close();
         $pdf->Output($file, 'F');
         if (!empty($conf->global->MAIN_UMASK)) {
             @chmod($file, octdec($conf->global->MAIN_UMASK));
         }
         return 1;
         // Pas d'erreur
     } else {
         $this->error = $langs->trans("ErrorConstantNotDefined", "AGF_OUTPUTDIR");
         return 0;
     }
     $this->error = $langs->trans("ErrorUnknown");
     return 0;
     // Erreur par defaut
 }
コード例 #13
0
ファイル: document.php プロジェクト: remyyounes/dolibarr
}


/*
 * View
 */

$form = new Form($db);
$member=new Adherent($db);
$membert=new AdherentType($db);

llxHeader();

if ($id > 0)
{
    $result=$member->fetch($id);
    $result=$membert->fetch($member->typeid);
	if ($result > 0)
	{
		/*
		 * Affichage onglets
		 */
		if ($conf->notification->enabled) $langs->load("mails");
		$head = member_prepare_head($member);

		$html=new Form($db);

		dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user');


		// Construit liste des fichiers
コード例 #14
0
ファイル: note.php プロジェクト: remyyounes/dolibarr
require_once(DOL_DOCUMENT_ROOT.'/lib/member.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php');
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");

$action=isset($_GET["action"])?$_GET["action"]:(isset($_POST["action"])?$_POST["action"]:"");
$id=isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:"");

$langs->load("companies");
$langs->load("members");
$langs->load("bills");

if (!$user->rights->adherent->lire)
  accessforbidden();

$adh = new Adherent($db);
$result=$adh->fetch($id);
if ($result > 0)
{
    $adht = new AdherentType($db);
    $result=$adht->fetch($adh->typeid);
}


/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/

if ($_POST["action"] == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
{
	$db->begin();
function _create_and_send($PDOdb, $db, $user, $conf, $langs)
{
    unset($_SESSION['SENDTOINVOICETOADHERENT_TERROR']);
    unset($_SESSION['SENDTOINVOICETOADHERENT_TERRORFAC']);
    unset($_SESSION['SENDTOINVOICETOADHERENT_TERRORMAIL']);
    $error = 0;
    $nb_mail_sent = 0;
    if (!$user->rights->sendinvoicetoadherent->create) {
        $error++;
        setEventMessages($langs->trans('sendinvoicetoadherentErrorCreateNotPermitted'), false, 'errors');
        header('Location: ' . dol_buildpath('/sendinvoicetoadherent/sendinvoicetoadherent.php?action=list', 2));
        exit;
    }
    dol_include_once('/compta/facture/class/facture-rec.class.php');
    dol_include_once('/compta/facture/class/adherent.class.php');
    dol_include_once('/adherents/class/adherent.class.php');
    dol_include_once('/societe/class/societe.class.php');
    dol_include_once('/core/class/CMailFile.class.php');
    dol_include_once('/core/lib/files.lib.php');
    $date_fac = GETPOST('date_fac', 'alpha');
    $create_cotisation = GETPOST('create_cotisation', 'int');
    $date_start = GETPOST('date_start', 'alpha');
    $date_end = GETPOST('date_end', 'alpha');
    $amount = price2num(GETPOST('amount_cotisation', 'alpha'), 2);
    $label = GETPOST('label', 'alpha');
    $TDate_fac = explode('/', $date_fac);
    if (!checkdate($TDate_fac[1], $TDate_fac[0], $TDate_fac[2])) {
        $error++;
        setEventMessages($langs->trans('sendinvoicetoadherentErrorDateFac'), false, 'errors');
    }
    if ($create_cotisation) {
        $TDate_start = explode('/', $date_start);
        $TDate_end = explode('/', $date_end);
        if (!checkdate($TDate_start[1], $TDate_start[0], $TDate_start[2]) || !checkdate($TDate_end[1], $TDate_end[0], $TDate_end[2])) {
            $error++;
            setEventMessages($langs->trans('sendinvoicetoadherentErrorDate'), false, 'errors');
        }
    }
    $fk_facture_rec = (int) $conf->global->SENDINVOICETOADHERENT_FK_FACTURE;
    if (!$fk_facture_rec) {
        $error++;
        setEventMessages($langs->trans('sendinvoicetoadherent_fk_facture'), false, 'errors');
    }
    if (!$error) {
        $sql = _getSql();
        if ($PDOdb->Execute($sql)) {
            $TError = $TErrorFac = $TErrorMail = array();
            while ($row = $PDOdb->Get_line()) {
                $ad = new Adherent($db);
                $ad->fetch($row->rowid);
                if (!$ad->fk_soc && $ad->societe) {
                    $societe = _createTiers($db, $user, $ad);
                } else {
                    $ad->fetch_thirdparty();
                    $societe = $ad->thirdparty;
                }
                if ($societe && $societe->id > 0) {
                    if ($create_cotisation) {
                        if ($ad->cotisation(dol_mktime(0, 0, 0, $TDate_start[1], $TDate_start[0], $TDate_start[2]), $amount, 0, '', $label, '', '', '', dol_mktime(0, 0, 0, $TDate_end[1], $TDate_end[0], $TDate_end[2])) <= 0) {
                            $error++;
                            setEventMessages($object->error, $object->errors, 'errors');
                        }
                    }
                    $factureRec = new FactureRec($db);
                    $factureRec->fetch($fk_facture_rec);
                    $facture = new Facture($db);
                    $facture->brouillon = 1;
                    $facture->socid = $societe->id;
                    $facture->type = Facture::TYPE_STANDARD;
                    $facture->fk_project = $factureRec->fk_project;
                    $facture->cond_reglement_id = $factureRec->cond_reglement_id;
                    $facture->mode_reglement_id = $factureRec->mode_reglement_id;
                    $facture->remise_absolue = $factureRec->remise_absolue;
                    $facture->remise_percent = $factureRec->remise_percent;
                    $facture->date = dol_mktime(12, 0, 0, $TDate_fac[1], $TDate_fac[0], $TDate_fac[2]);
                    $facture->note_private = $factureRec->note_private;
                    $facture->note_public = $factureRec->note_public;
                    $facture->lines = $factureRec->lines;
                    if ($facture->create($user) > 0) {
                        $facture->validate($user);
                        if (!_sendByMail($db, $conf, $user, $langs, $facture, $societe, $label)) {
                            $TErrorMail[] = $societe->id;
                        }
                    } else {
                        $TErrorFac[] = $societe->id;
                    }
                } else {
                    $TError[] = $ad->id;
                }
            }
            if (count($TError) > 0) {
                setEventMessages($langs->trans('sendinvoicetoadherentErrorCreateTiers', count($TError)), null, 'errors');
            }
            if (count($TErrorFac) > 0) {
                setEventMessages($langs->trans('sendinvoicetoadherentErrorCreateFacture', count($TErrorFac)), null, 'errors');
            }
            if (count($TErrorMail) > 0) {
                setEventMessages($langs->trans('sendinvoicetoadherentErrorMailSend', count($TErrorMail)), null, 'errors');
            } else {
                setEventMessages($langs->trans('sendinvoicetoadherentConfirmCreate', $PDOdb->Get_Recordcount()), null);
            }
            $_SESSION['SENDTOINVOICETOADHERENT_ERRORS'] = array('TError' => $TError, 'TErrorFac' => $TErrorFac, '');
            $_SESSION['SENDTOINVOICETOADHERENT_TERROR'] = $TError;
            $_SESSION['SENDTOINVOICETOADHERENT_TERRORFAC'] = $TErrorFac;
            $_SESSION['SENDTOINVOICETOADHERENT_TERRORMAIL'] = $TErrorMail;
            header('Location: ' . dol_buildpath('/sendinvoicetoadherent/sendinvoicetoadherent.php?action=list', 2));
            exit;
        }
    } else {
        _create($PDOdb, $db, $user, $conf, $langs, $date_fac, $date_start, $date_end, $amount, $label);
    }
}
コード例 #16
0
ファイル: ldap.php プロジェクト: TAASA/Dolibarr-ERP-3.8.1
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
$langs->load("companies");
$langs->load("members");
$langs->load("ldap");
$langs->load("admin");
$rowid = GETPOST('id', 'int');
$action = GETPOST('action');
// Protection
$socid = 0;
if ($user->societe_id > 0) {
    $socid = $user->societe_id;
}
$adh = new Adherent($db);
$adh->id = $rowid;
$result = $adh->fetch($rowid);
if (!$result) {
    dol_print_error($db, "Failed to get adherent: " . $adh->error);
    exit;
}
/*
 * Actions
 */
if ($action == 'dolibarr2ldap') {
    $db->begin();
    $ldap = new Ldap();
    $result = $ldap->connect_bind();
    $info = $adh->_load_ldap_info();
    $dn = $adh->_load_ldap_dn($info);
    $olddn = $dn;
    // We can say that old dn = dn as we force synchro
コード例 #17
0
	exit(-1);
}
*/
$sql = "SELECT rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent";
$resql = $db->query($sql);
if ($resql) {
    $num = $db->num_rows($resql);
    $i = 0;
    $ldap = new Ldap();
    $ldap->connect_bind();
    while ($i < $num) {
        $ldap->error = "";
        $obj = $db->fetch_object($resql);
        $member = new Adherent($db);
        $result = $member->fetch($obj->rowid);
        if ($result < 0) {
            dol_print_error($db, $member->error);
            exit(-1);
        }
        $result = $member->fetch_subscriptions();
        if ($result < 0) {
            dol_print_error($db, $member->error);
            exit(-1);
        }
        print $langs->transnoentities("UpdateMember") . " rowid=" . $member->id . " " . $member->getFullName($langs);
        $oldobject = $member;
        $oldinfo = $oldobject->_load_ldap_info();
        $olddn = $oldobject->_load_ldap_dn($oldinfo);
        $info = $member->_load_ldap_info();
        $dn = $member->_load_ldap_dn($info);
コード例 #18
0
ファイル: fiche.php プロジェクト: remyyounes/dolibarr
	}

    // TVA Intra
    print '<tr><td nowrap>'.$langs->trans('VATIntraVeryShort').'</td><td colspan="3">';
    print $objsoc->tva_intra;
    print '</td></tr>';

    // Module Adherent
    if ($conf->adherent->enabled)
    {
        $langs->load("members");
        $langs->load("users");
        print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
        print '<td colspan="3">';
        $adh=new Adherent($db);
        $result=$adh->fetch('','',$societe->id);
        if ($result > 0)
        {
            $adh->ref=$adh->getFullName($langs);
            print $adh->getNomUrl(1);
        }
        else
        {
            print $langs->trans("UserNotLinkedToMember");
        }
        print '</td>';
        print "</tr>\n";
    }

	print '</table>';
コード例 #19
0
ファイル: cibles.php プロジェクト: Albertopf/prueba
 $obj = $db->fetch_object($resql);
 $var = !$var;
 print "<tr " . $bc[$var] . ">";
 print '<td>' . $obj->email . '</td>';
 print '<td>' . $obj->lastname . '</td>';
 print '<td>' . $obj->firstname . '</td>';
 print '<td>' . $obj->other . '</td>';
 print '<td align="center">';
 if (empty($obj->source_id) || empty($obj->source_type)) {
     print $obj->source_url;
     // For backward compatibility
 } else {
     if ($obj->source_type == 'member') {
         include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
         $objectstatic = new Adherent($db);
         $objectstatic->fetch($obj->source_id);
         print $objectstatic->getNomUrl(2);
     } else {
         if ($obj->source_type == 'user') {
             include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
             $objectstatic = new User($db);
             $objectstatic->fetch($obj->source_id);
             $objectstatic->id = $obj->source_id;
             print $objectstatic->getNomUrl(2);
         } else {
             if ($obj->source_type == 'thirdparty') {
                 include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
                 $objectstatic = new Societe($db);
                 $objectstatic->fetch($obj->source_id);
                 print $objectstatic->getNomUrl(2);
             } else {
コード例 #20
0
    /**
     *      Update parameters of third party
     *
     *      @param	int		$id              			id societe
     *      @param  User	$user            			Utilisateur qui demande la mise a jour
     *      @param  int		$call_trigger    			0=non, 1=oui
     *		@param	int		$allowmodcodeclient			Inclut modif code client et code compta
     *		@param	int		$allowmodcodefournisseur	Inclut modif code fournisseur et code compta fournisseur
     *		@param	string	$action						'add' or 'update'
     *		@param	int		$nosyncmember				Do not synchronize info of linked member
     *      @return int  			           			<0 if KO, >=0 if OK
     */
    function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update', $nosyncmember=1)
    {
        global $langs,$conf,$hookmanager;
        require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

		$error=0;

        dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);

        $now=dol_now();

        // Clean parameters
        $this->id			= $id;
        $this->name			= $this->name?trim($this->name):trim($this->nom);
        $this->nom			= $this->name;	// For backward compatibility
	    $this->name_alias = trim($this->name_alias);
        $this->ref_ext		= trim($this->ref_ext);
        $this->address		= $this->address?trim($this->address):trim($this->address);
        $this->zip			= $this->zip?trim($this->zip):trim($this->zip);
        $this->town			= $this->town?trim($this->town):trim($this->town);
        $this->state_id		= trim($this->state_id);
        $this->country_id	= ($this->country_id > 0)?$this->country_id:0;
        $this->phone		= trim($this->phone);
        $this->phone		= preg_replace("/\s/","",$this->phone);
        $this->phone		= preg_replace("/\./","",$this->phone);
        $this->fax			= trim($this->fax);
        $this->fax			= preg_replace("/\s/","",$this->fax);
        $this->fax			= preg_replace("/\./","",$this->fax);
        $this->email		= trim($this->email);
        $this->skype		= trim($this->skype);
        $this->url			= $this->url?clean_url($this->url,0):'';
        $this->idprof1		= trim($this->idprof1);
        $this->idprof2		= trim($this->idprof2);
        $this->idprof3		= trim($this->idprof3);
        $this->idprof4		= trim($this->idprof4);
        $this->idprof5		= (! empty($this->idprof5)?trim($this->idprof5):'');
        $this->idprof6		= (! empty($this->idprof6)?trim($this->idprof6):'');
        $this->prefix_comm	= trim($this->prefix_comm);

        $this->tva_assuj	= trim($this->tva_assuj);
        $this->tva_intra	= dol_sanitizeFileName($this->tva_intra,'');
        if (empty($this->status)) $this->status = 0;

		if (!empty($this->multicurrency_code)) $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
		if (empty($this->fk_multicurrency))
		{
			$this->multicurrency_code = '';
			$this->fk_multicurrency = 0;
		}

        // Local taxes
        $this->localtax1_assuj=trim($this->localtax1_assuj);
        $this->localtax2_assuj=trim($this->localtax2_assuj);

        $this->localtax1_value=trim($this->localtax1_value);
        $this->localtax2_value=trim($this->localtax2_value);

        if ($this->capital != '') $this->capital=price2num(trim($this->capital));
        if (! is_numeric($this->capital)) $this->capital = '';     // '' = undef

        $this->effectif_id=trim($this->effectif_id);
        $this->forme_juridique_code=trim($this->forme_juridique_code);

        //Gencod
        $this->barcode=trim($this->barcode);

        // For automatic creation
        if ($this->code_client == -1) $this->get_codeclient($this,0);
        if ($this->code_fournisseur == -1) $this->get_codefournisseur($this,1);

        $this->code_compta=trim($this->code_compta);
        $this->code_compta_fournisseur=trim($this->code_compta_fournisseur);

        // Check parameters
        if (! empty($conf->global->SOCIETE_MAIL_REQUIRED) && ! isValidEMail($this->email))
        {
            $langs->load("errors");
            $this->error = $langs->trans("ErrorBadEMail",$this->email);
            return -1;
        }
        if (! is_numeric($this->client) && ! is_numeric($this->fournisseur))
        {
            $langs->load("errors");
            $this->error = $langs->trans("BadValueForParameterClientOrSupplier");
            return -1;
        }

        $customer=false;
        if (! empty($allowmodcodeclient) && ! empty($this->client))
        {
        	// Attention get_codecompta peut modifier le code suivant le module utilise
        	if (empty($this->code_compta))
        	{
        		$ret=$this->get_codecompta('customer');
        		if ($ret < 0) return -1;
        	}

        	$customer=true;
        }

        $supplier=false;
        if (! empty($allowmodcodefournisseur) && ! empty($this->fournisseur))
        {
        	// Attention get_codecompta peut modifier le code suivant le module utilise
        	if (empty($this->code_compta_fournisseur))
        	{
        		$ret=$this->get_codecompta('supplier');
        		if ($ret < 0) return -1;
        	}

        	$supplier=true;
        }

        //Web services
        $this->webservices_url = $this->webservices_url?clean_url($this->webservices_url,0):'';
        $this->webservices_key = trim($this->webservices_key);

        //Incoterms
        $this->fk_incoterms = (int) $this->fk_incoterms;
		$this->location_incoterms = trim($this->location_incoterms);

        $this->db->begin();

        // Check name is required and codes are ok or unique.
        // If error, this->errors[] is filled
        $result = 0;
        if ($action != 'add') $result = $this->verify();	// We don't check when update called during a create because verify was already done

        if ($result >= 0)
        {
            dol_syslog(get_class($this)."::update verify ok or not done");

            $sql  = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
            $sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required
            $sql .= ",name_alias = '" . $this->db->escape($this->name_alias) ."'";
            $sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null");
            $sql .= ",address = '" . $this->db->escape($this->address) ."'";

            $sql .= ",zip = ".(! empty($this->zip)?"'".$this->db->escape($this->zip)."'":"null");
            $sql .= ",town = ".(! empty($this->town)?"'".$this->db->escape($this->town)."'":"null");

            $sql .= ",fk_departement = '" . (! empty($this->state_id)?$this->state_id:'0') ."'";
            $sql .= ",fk_pays = '" . (! empty($this->country_id)?$this->country_id:'0') ."'";

            $sql .= ",phone = ".(! empty($this->phone)?"'".$this->db->escape($this->phone)."'":"null");
            $sql .= ",fax = ".(! empty($this->fax)?"'".$this->db->escape($this->fax)."'":"null");
            $sql .= ",email = ".(! empty($this->email)?"'".$this->db->escape($this->email)."'":"null");
            $sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
            $sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");

            $sql .= ",siren   = '". $this->db->escape($this->idprof1) ."'";
            $sql .= ",siret   = '". $this->db->escape($this->idprof2) ."'";
            $sql .= ",ape     = '". $this->db->escape($this->idprof3) ."'";
            $sql .= ",idprof4 = '". $this->db->escape($this->idprof4) ."'";
            $sql .= ",idprof5 = '". $this->db->escape($this->idprof5) ."'";
            $sql .= ",idprof6 = '". $this->db->escape($this->idprof6) ."'";

            $sql .= ",tva_assuj = ".($this->tva_assuj!=''?"'".$this->tva_assuj."'":"null");
            $sql .= ",tva_intra = '" . $this->db->escape($this->tva_intra) ."'";
            $sql .= ",status = " .$this->status;

            // Local taxes
            $sql .= ",localtax1_assuj = ".($this->localtax1_assuj!=''?"'".$this->localtax1_assuj."'":"null");
            $sql .= ",localtax2_assuj = ".($this->localtax2_assuj!=''?"'".$this->localtax2_assuj."'":"null");
            if($this->localtax1_assuj==1)
            {
            	if($this->localtax1_value!='')
            	{
            		$sql .=",localtax1_value =".$this->localtax1_value;
            	}
            	else $sql .=",localtax1_value =0.000";

            }
            else $sql .=",localtax1_value =0.000";

            if($this->localtax2_assuj==1)
            {
            	if($this->localtax2_value!='')
            	{
            		$sql .=",localtax2_value =".$this->localtax2_value;
            	}
            	else $sql .=",localtax2_value =0.000";

            }
            else $sql .=",localtax2_value =0.000";

            $sql .= ",capital = ".($this->capital == '' ? "null" : $this->capital);

            $sql .= ",prefix_comm = ".(! empty($this->prefix_comm)?"'".$this->db->escape($this->prefix_comm)."'":"null");

            $sql .= ",fk_effectif = ".(! empty($this->effectif_id)?"'".$this->db->escape($this->effectif_id)."'":"null");

            $sql .= ",fk_typent = ".(! empty($this->typent_id)?"'".$this->db->escape($this->typent_id)."'":"0");

            $sql .= ",fk_forme_juridique = ".(! empty($this->forme_juridique_code)?"'".$this->db->escape($this->forme_juridique_code)."'":"null");

            $sql .= ",client = " . (! empty($this->client)?$this->client:0);
            $sql .= ",fournisseur = " . (! empty($this->fournisseur)?$this->fournisseur:0);
            $sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null");
            $sql .= ",default_lang = ".(! empty($this->default_lang)?"'".$this->db->escape($this->default_lang)."'":"null");
            $sql .= ",logo = ".(! empty($this->logo)?"'".$this->db->escape($this->logo)."'":"null");

            $sql .= ",webservices_url = ".(! empty($this->webservices_url)?"'".$this->db->escape($this->webservices_url)."'":"null");
            $sql .= ",webservices_key = ".(! empty($this->webservices_key)?"'".$this->db->escape($this->webservices_key)."'":"null");

			//Incoterms
			$sql.= ", fk_incoterms = ".$this->fk_incoterms;
			$sql.= ", location_incoterms = ".(! empty($this->location_incoterms)?"'".$this->db->escape($this->location_incoterms)."'":"null");

            if ($customer)
            {
                $sql .= ", code_client = ".(! empty($this->code_client)?"'".$this->db->escape($this->code_client)."'":"null");
                $sql .= ", code_compta = ".(! empty($this->code_compta)?"'".$this->db->escape($this->code_compta)."'":"null");
            }

            if ($supplier)
            {
                $sql .= ", code_fournisseur = ".(! empty($this->code_fournisseur)?"'".$this->db->escape($this->code_fournisseur)."'":"null");
                $sql .= ", code_compta_fournisseur = ".(! empty($this->code_compta_fournisseur)?"'".$this->db->escape($this->code_compta_fournisseur)."'":"null");
            }
            $sql .= ", fk_user_modif = ".(! empty($user->id)?"'".$user->id."'":"null");
			$sql .= ", fk_multicurrency = ".(int) $this->fk_multicurrency;
			$sql .= ', multicurrency_code = "'.$this->db->escape($this->multicurrency_code).'"';
            $sql .= " WHERE rowid = '" . $id ."'";


            dol_syslog(get_class($this)."::Update", LOG_DEBUG);
            $resql=$this->db->query($sql);
            if ($resql)
            {
            	unset($this->country_code);		// We clean this because it may have been changed after an update of country_id
            	unset($this->country);
            	unset($this->state_code);
            	unset($this->state);

            	$nbrowsaffected = $this->db->affected_rows($resql);

            	if (! $error && $nbrowsaffected)
            	{
            		// Update information on linked member if it is an update
	            	if (! $nosyncmember && ! empty($conf->adherent->enabled))
	            	{
		            	require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';

		            	dol_syslog(get_class($this)."::update update linked member");

		            	$lmember=new Adherent($this->db);
		            	$result=$lmember->fetch(0, 0, $this->id);

		            	if ($result > 0)
		            	{
		            		$lmember->societe=$this->name;
		            		//$lmember->firstname=$this->firstname?$this->firstname:$lmember->firstname;	// We keep firstname and lastname of member unchanged
		            		//$lmember->lastname=$this->lastname?$this->lastname:$lmember->lastname;		// We keep firstname and lastname of member unchanged
		            		$lmember->address=$this->address;
		            		$lmember->email=$this->email;
                    		$lmember->skype=$this->skype;
		            		$lmember->phone=$this->phone;

		            		$result=$lmember->update($user,0,1,1,1);	// Use nosync to 1 to avoid cyclic updates
		            		if ($result < 0)
		            		{
		            			$this->error=$lmember->error;
		            			dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
		            			$error++;
		            		}
		            	}
		            	else if ($result < 0)
		            	{
		            		$this->error=$lmember->error;
		            		$error++;
		            	}
	            	}
            	}

            	$action='update';

                // Actions on extra fields (by external module or standard code)
                // TODO le hook fait double emploi avec le trigger !!
                $hookmanager->initHooks(array('thirdpartydao'));
                $parameters=array('socid'=>$this->id);
                $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
                if (empty($reshook))
                {
                	if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
                	{
                		$result=$this->insertExtraFields();
                		if ($result < 0)
                		{
                			$error++;
                		}
                	}
                }
                else if ($reshook < 0) $error++;

                if (! $error && $call_trigger)
                {
                    // Call trigger
                    $result=$this->call_trigger('COMPANY_MODIFY',$user);
                    if ($result < 0) $error++;
                    // End call triggers
                }

                if (! $error)
                {
                    dol_syslog(get_class($this)."::Update success");
                    $this->db->commit();
                    return 1;
                }
                else
				{
                    $this->db->rollback();
                    return -1;
                }
            }
            else
			{
                if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
                {
                    // Doublon
                    $this->error = $langs->trans("ErrorDuplicateField");
                    $result =  -1;
                }
                else
                {
                    $result =  -2;
                }
                $this->db->rollback();
                return $result;
            }
        }
        else
       {
            $this->db->rollback();
            dol_syslog(get_class($this)."::Update fails verify ".join(',',$this->errors), LOG_WARNING);
            return -3;
        }
    }
コード例 #21
0
            $action = '';
        }
    }
}
if ($action == 'setsocid') {
    $error = 0;
    if (!$error) {
        if (GETPOST('socid', 'int') != $object->fk_soc) {
            $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent";
            $sql .= " WHERE fk_soc = '" . GETPOST('socid', 'int') . "'";
            $resql = $db->query($sql);
            if ($resql) {
                $obj = $db->fetch_object($resql);
                if ($obj && $obj->rowid > 0) {
                    $othermember = new Adherent($db);
                    $othermember->fetch($obj->rowid);
                    $thirdparty = new Societe($db);
                    $thirdparty->fetch(GETPOST('socid', 'int'));
                    $error++;
                    setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), null, 'errors');
                }
            }
            if (!$error) {
                $result = $object->setThirdPartyId(GETPOST('socid', 'int'));
                if ($result < 0) {
                    dol_print_error('', $object->error);
                }
                $_POST['action'] = '';
                $action = '';
            }
        }
コード例 #22
0
ファイル: public_card.php プロジェクト: Samara94/dolibarr
 */
// None
/*
 * View
 */
$morehead = '';
if (!empty($conf->global->MEMBER_PUBLIC_CSS)) {
    $morehead = '<link rel="stylesheet" type="text/css" href="' . $conf->global->MEMBER_PUBLIC_CSS . '">';
} else {
    $morehead = '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/theme/eldy/style.css.php' . '">';
}
llxHeaderVierge($langs->trans("MemberCard"), $morehead);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('adherent');
if ($id > 0) {
    $res = $object->fetch($id);
    if ($res < 0) {
        dol_print_error($db, $object->error);
        exit;
    }
    $res = $object->fetch_optionals($object->id, $extralabels);
    print load_fiche_titre($langs->trans("MemberCard"), '', '');
    if (empty($object->public)) {
        print $langs->trans("ErrorThisMemberIsNotPublic");
    } else {
        print '<table class="public_border" cellspacing="0" width="100%" cellpadding="3">';
        print '<tr><td width="15%">' . $langs->trans("Type") . '</td><td class="valeur">' . $object->type . "</td></tr>\n";
        print '<tr><td>' . $langs->trans("Person") . '</td><td class="valeur">' . $object->morphy . '</td></tr>';
        print '<tr><td>' . $langs->trans("Firstname") . '</td><td class="valeur" width="35%">' . $object->firstname . '&nbsp;</td></tr>';
        print '<tr><td>' . $langs->trans("Lastname") . '</td><td class="valeur">' . $object->lastname . '&nbsp;</td></tr>';
        print '<tr><td>' . $langs->trans("Company") . '</td><td class="valeur">' . $object->societe . '&nbsp;</td></tr>';
コード例 #23
0
ファイル: newpayment.php プロジェクト: remyyounes/dolibarr
    $email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
	print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";

}

// Payment on member subscription
if (GETPOST("source") == 'membersubscription')
{
	$found=true;
	$langs->load("members");

	require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
	require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");

	$member=new Adherent($db);
	$result=$member->fetch('',GETPOST("ref"));
	if ($result < 0)
	{
		$mesg=$member->error;
		$error++;
	}
	else
	{
		$subscription=new Cotisation($db);
	}

	$amount=$subscription->total_ttc;
    if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
    $amount=price2num($amount);

	$fulltag='MID='.$member->id.'.M='.strtr($member->getFullName($langs),"-"," ");
コード例 #24
0
/**
 *      \file       htdocs/adherents/info.php
 *      \ingroup    member
 *		\brief      Page des informations d'un adherent
 */
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
$langs->load("companies");
$langs->load("bills");
$langs->load("members");
$langs->load("users");
$id = GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('rowid', 'int');
// Security check
$result = restrictedArea($user, 'adherent', $id);
/*
 * View
 */
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$adh = new Adherent($db);
$adh->fetch($id);
$adh->info($id);
$head = member_prepare_head($adh);
dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user');
print '<table width="100%"><tr><td>';
dol_print_object_info($adh);
print '</td></tr></table>';
print '</div>';
llxFooter();
$db->close();
コード例 #25
0
ファイル: newpayment.php プロジェクト: ADDAdev/Dolibarr
        print '<input type="hidden" name="shipToStreet2" value="' . $shipToStreet2 . '">' . "\n";
        print '<input type="hidden" name="phoneNum" value="' . $phoneNum . '">' . "\n";
    } else {
        print '<!-- Shipping address not complete, so we don t use it -->' . "\n";
    }
    print '<input type="hidden" name="email" value="' . $contract->thirdparty->email . '">' . "\n";
    print '<input type="hidden" name="desc" value="' . $langs->trans("Contract") . ' ' . $contract->ref . '">' . "\n";
}
// Payment on member subscription
if (GETPOST("source") == 'membersubscription' && $valid) {
    $found = true;
    $langs->load("members");
    require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
    require_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php';
    $member = new Adherent($db);
    $result = $member->fetch('', $ref);
    if ($result < 0) {
        $mesg = $member->error;
        $error++;
    } else {
        $subscription = new Cotisation($db);
    }
    $amount = $subscription->total_ttc;
    if (GETPOST("amount", 'int')) {
        $amount = GETPOST("amount", 'int');
    }
    $amount = price2num($amount);
    $fulltag = 'MEM=' . $member->id . '.DAT=' . dol_print_date(dol_now(), '%Y%m%d%H%M');
    if (!empty($TAG)) {
        $tag = $TAG;
        $fulltag .= '.TAG=' . $TAG;
コード例 #26
0
ファイル: cibles.php プロジェクト: Samara94/dolibarr
 $obj = $db->fetch_object($resql);
 $var = !$var;
 print "<tr " . $bc[$var] . ">";
 print '<td>' . $obj->email . '</td>';
 print '<td>' . $obj->lastname . '</td>';
 print '<td>' . $obj->firstname . '</td>';
 print '<td>' . $obj->other . '</td>';
 print '<td align="center">';
 if (empty($obj->source_id) || empty($obj->source_type)) {
     print $obj->source_url;
     // For backward compatibility
 } else {
     if ($obj->source_type == 'member') {
         include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
         $m = new Adherent($db);
         $m->fetch($obj->source_id);
         print $m->getNomUrl(2);
     } else {
         if ($obj->source_type == 'user') {
             include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
             $m = new User($db);
             $m->fetch($obj->source_id);
             $m->id = $obj->source_id;
             print $m->getNomUrl(2);
         } else {
             if ($obj->source_type == 'thirdparty') {
                 include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
                 $m = new Societe($db);
                 $m->fetch($obj->source_id);
                 print $m->getNomUrl(2);
             } else {
コード例 #27
0
 /**
  *	Delete a subscription
  *
  *	@param	User	$user		User that delete
  *	@return	int					<0 if KO, 0 if not found, >0 if OK
  */
 function delete($user)
 {
     // It subscription is linked to a bank transaction, we get it
     if ($this->fk_bank) {
         require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
         $accountline = new AccountLine($this->db);
         $result = $accountline->fetch($this->fk_bank);
     }
     $this->db->begin();
     $sql = "DELETE FROM " . MAIN_DB_PREFIX . "cotisation WHERE rowid = " . $this->id;
     dol_syslog(get_class($this) . "::delete sql=" . $sql);
     $resql = $this->db->query($sql);
     if ($resql) {
         $num = $this->db->affected_rows($resql);
         if ($num) {
             require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
             $member = new Adherent($this->db);
             $result = $member->fetch($this->fk_adherent);
             $result = $member->update_end_date($user);
             if ($accountline->rowid > 0) {
                 $result = $accountline->delete($user);
                 // Return false if refused because line is conciliated
                 if ($result > 0) {
                     $this->db->commit();
                     return 1;
                 } else {
                     $this->error = $accountline->error;
                     $this->db->rollback();
                     return -1;
                 }
             } else {
                 $this->db->commit();
                 return 1;
             }
         } else {
             $this->db->commit();
             return 0;
         }
     } else {
         $this->error = $this->db->lasterror();
         $this->db->rollback();
         return -1;
     }
 }
コード例 #28
0
ファイル: user.class.php プロジェクト: Samara94/dolibarr
 /**
  *  Change password of a user
  *
  *  @param	User	$user             		Object user of user making change
  *  @param  string	$password         		New password in clear text (to generate if not provided)
  *	@param	int		$changelater			1=Change password only after clicking on confirm email
  *	@param	int		$notrigger				1=Does not launch triggers
  *	@param	int		$nosyncmember	        Do not synchronize linked member
  *  @return string 			          		If OK return clear password, 0 if no change, < 0 if error
  */
 function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0)
 {
     global $conf, $langs;
     require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
     $error = 0;
     dol_syslog(get_class($this) . "::setPassword user="******" password="******" changelater=" . $changelater . " notrigger=" . $notrigger . " nosyncmember=" . $nosyncmember, LOG_DEBUG);
     // If new password not provided, we generate one
     if (!$password) {
         $password = getRandomPassword(false);
     }
     // Crypte avec md5
     $password_crypted = dol_hash($password);
     // Mise a jour
     if (!$changelater) {
         if (!is_object($this->oldcopy)) {
             $this->oldcopy = clone $this;
         }
         $this->db->begin();
         $sql = "UPDATE " . MAIN_DB_PREFIX . "user";
         $sql .= " SET pass_crypted = '" . $this->db->escape($password_crypted) . "',";
         $sql .= " pass_temp = null";
         if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
             $sql .= ", pass = null";
         } else {
             $sql .= ", pass = '******'";
         }
         $sql .= " WHERE rowid = " . $this->id;
         dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG);
         $result = $this->db->query($sql);
         if ($result) {
             if ($this->db->affected_rows($result)) {
                 $this->pass = $password;
                 $this->pass_indatabase = $password;
                 $this->pass_indatabase_crypted = $password_crypted;
                 if ($this->fk_member && !$nosyncmember) {
                     require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
                     // This user is linked with a member, so we also update members informations
                     // if this is an update.
                     $adh = new Adherent($this->db);
                     $result = $adh->fetch($this->fk_member);
                     if ($result >= 0) {
                         $result = $adh->setPassword($user, $this->pass, 0, 1);
                         // Cryptage non gere dans module adherent
                         if ($result < 0) {
                             $this->error = $adh->error;
                             dol_syslog(get_class($this) . "::setPassword " . $this->error, LOG_ERR);
                             $error++;
                         }
                     } else {
                         $this->error = $adh->error;
                         $error++;
                     }
                 }
                 dol_syslog(get_class($this) . "::setPassword notrigger=" . $notrigger . " error=" . $error, LOG_DEBUG);
                 if (!$error && !$notrigger) {
                     // Call trigger
                     $result = $this->call_trigger('USER_NEW_PASSWORD', $user);
                     if ($result < 0) {
                         $error++;
                         $this->db->rollback();
                         return -1;
                     }
                     // End call triggers
                 }
                 $this->db->commit();
                 return $this->pass;
             } else {
                 $this->db->rollback();
                 return 0;
             }
         } else {
             $this->db->rollback();
             dol_print_error($this->db);
             return -1;
         }
     } else {
         // We store clear password in password temporary field.
         // After receiving confirmation link, we will crypt it and store it in pass_crypted
         $sql = "UPDATE " . MAIN_DB_PREFIX . "user";
         $sql .= " SET pass_temp = '" . $this->db->escape($password) . "'";
         $sql .= " WHERE rowid = " . $this->id;
         dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG);
         // No log
         $result = $this->db->query($sql);
         if ($result) {
             return $password;
         } else {
             dol_print_error($this->db);
             return -3;
         }
     }
 }
コード例 #29
0
ファイル: soc.php プロジェクト: nrjacker4/crm-php
                print $langs->trans("NoParentCompany");
            }
            print '</td></tr>';
        }

        // Sales representative
        include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php');

        // Module Adherent
        if ($conf->adherent->enabled)
        {
            $langs->load("members");
            print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
            print '<td colspan="3">';
            $adh=new Adherent($db);
            $result=$adh->fetch('','',$object->id);
            if ($result > 0)
            {
                $adh->ref=$adh->getFullName($langs);
                print $adh->getNomUrl(1);
            }
            else
            {
                print $langs->trans("UserNotLinkedToMember");
            }
            print '</td>';
            print "</tr>\n";
        }

        print '</table>';
コード例 #30
0
ファイル: info.php プロジェクト: Samara94/dolibarr
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
$langs->load("companies");
$langs->load("bills");
$langs->load("members");
$langs->load("users");
$id = GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('rowid', 'int');
// Security check
$result = restrictedArea($user, 'adherent', $id);
/*
 * View
 */
$form = new Form($db);
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$object = new Adherent($db);
$object->fetch($id);
$object->info($id);
$head = member_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user');
$linkback = '<a href="' . DOL_URL_ROOT . '/adherents/list.php">' . $langs->trans("BackToList") . '</a>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
dol_print_object_info($object);
print '</div>';
dol_fiche_end();
llxFooter();
$db->close();