function update_collaborateur_interne($recherche) { $champs_collab = array('MNEMONIC' => 1, 'NOM' => 1, 'PRENOM' => 1, 'NOMJEUNEFILLE' => 0, 'CIVILITE' => 1, 'ETAT' => 0, 'ARCHIVE' => 0, 'TEL' => 0, 'PRT' => 1, 'EMAIL' => 0, 'EMAILAPSA' => 1, 'TAUNO' => 0); $champs_interne = array('DTNAISSANCE' => 1, 'NSS' => 0, 'LIEUNAISSANCE' => 1, 'NATIONALITE' => 0, 'ADRESSE' => 1, 'ADRESSE2' => 0, 'CP' => 1, 'VILLE' => 1, 'FONCTION' => 0, 'STATUT' => 0, 'COEFF' => 0, 'POSITION' => 0, 'TYPECONTRAT' => 0, 'TYPEHORAIRE' => 0, 'DTENTREE' => 1, 'DTDEPART' => 0, 'REMUNFIXE' => 0, 'REMUNVAR' => 0, 'NOMBANQUE' => 0, 'PERIODEESSAI' => 0, 'PPE' => 0, 'TR' => 0, 'FACTURABLE' => 0, 'GSM' => 0, 'PEE' => 0, 'TREIZIEME' => 0, 'PRIME_ANCI' => 0, 'PART_VARI' => 0, 'FRAIS' => 0, 'IBAN' => 0, 'BIC' => 0); $vars_collab = verif_champs($champs_collab, 'COL_'); $vars_specif = verif_champs($champs_interne, 'INT_'); if (is_array($vars_collab) && is_array($vars_specif)) { $vars_collab['TAU_NO'] = $vars_collab['COL_TAUNO']; $vars_specif['FCT_NO'] = $vars_specif['INT_FONCTION']; unset($vars_collab['COL_TAUNO'], $vars_specif['INT_FONCTION']); $query = "SELECT COL_MNEMONIC FROM COLLABORATEUR WHERE COL_MNEMONIC = '" . $vars_collab['COL_MNEMONIC'] . "' AND COL_NO !=" . $recherche; $result = $GLOBALS['connexion']->query($query); if ($result->num_rows != 0) { return 'Mnémonique déjà utilisé pour un autre collaborateur'; } else { $query = creer_update($vars_collab, 'COLLABORATEUR', "COL_NO = " . $recherche); $GLOBALS['connexion']->query($query); $query = creer_update($vars_specif, 'INTERNE', "COL_NO = " . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } } else { $erreur = is_string($vars_collab) ? $vars_collab . "\n" : ''; $erreur .= is_string($vars_specif) ? $vars_specif : ''; return $erreur; } header('Location:' . $url); }
function update_entreprise($recherche) { if (!empty($_FILES['LOGO']['name'])) { $dossier = 'image/'; $fichier = basename($_FILES['LOGO']['name']); move_uploaded_file($_FILES['LOGO']['tmp_name'], $dossier . $fichier); $_POST['LOGO'] = $dossier . $fichier; } else { if ($_POST['IMGENT'] != '') { $_POST['LOGO'] = $_POST['IMGENT']; } } if (!empty($_FILES['LOGOPIED']['name'])) { $dossier = 'image/'; $fichier = basename($_FILES['LOGOPIED']['name']); move_uploaded_file($_FILES['LOGOPIED']['tmp_name'], $dossier . $fichier); $_POST['LOGOPIED'] = $dossier . $fichier; } else { if ($_POST['IMGPIE'] != '') { $_POST['LOGOPIED'] = $_POST['IMGPIE']; } } $champs = array('NOM' => 1, 'STATUT' => 1, 'ADRESSE' => 1, 'ADRESSE_2' => 0, 'CP' => 1, 'TEL' => 1, 'VILLE' => 1, 'CAPITAL' => 1, 'TVA_INTRA' => 1, 'RCS' => 1, 'SIRET' => 1, 'APE' => 1, 'SITE_WEB' => 0, 'LOGO' => 1, 'LOGOPIED' => 0); $vars = verif_champs($champs, 'ENT_'); if (is_array($vars)) { $query = creer_update($vars, 'ENTREPRISE', "ENT_NO=" . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_client($recherche) { $champs = array('CODE' => 1, 'NOM' => 1, 'ADRCOM_1' => 1, 'ADRCOM_2' => 0, 'CPCOM' => 1, 'VILLECOM' => 1, 'DTCREATION' => 1, 'NOMFAC' => 0, 'ADRFAC_1' => 0, 'ADRFAC_2' => 0, 'CPFAC' => 0, 'VILLEFAC' => 0, 'PAYS' => 0, 'CODE_FOUR' => 0); $vars = verif_champs($champs, 'CLI_'); if (is_array($vars)) { $vars['CLI_LOGO'] = 'client/images_clients/' . $vars['CLI_LOGO']; $query = creer_update($vars, 'CLIENT', "CLI_NO=" . $recherche); $GLOBALS['connexion']->query($query); } else { return $vars; } return ''; }
function update_modereglement($recherche) { $champs = array('CODE' => 1, 'LIBELLE' => 1); $vars = verif_champs($champs, 'MOR_'); if (is_array($vars)) { $query = creer_update($vars, 'MODEREGLEMENT', "MOR_NO=" . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_fonction($recherche) { $champs = array('NOM' => 1); $vars = verif_champs($champs, 'FCT_'); if (is_array($vars)) { $query = creer_update($vars, 'FONCTION', "FCT_NO=" . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_banque($recherche) { $champs = array('NOM' => 1, 'CDE_BAN' => 1, 'CDE_GUI' => 1, 'NUM_CPT' => 1, 'RIB' => 1); $vars = verif_champs($champs, 'BAN_'); if (is_array($vars)) { $query = creer_update($vars, 'BANQUE', "BAN_NO=" . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_fournisseur($recherche) { $champs = array('CODE' => 1, 'DTCREATION' => 1, 'NOM' => 1, 'ARCHIVE' => 0); $vars = verif_champs($champs, 'FOU_'); if (is_array($vars)) { $query = creer_update($vars, 'FOURNISSEUR', "FOU_NO=" . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_contact_client($recherche) { $champs = array('CLIENT' => 1, 'NOM' => 1, 'PRENOM' => 1, 'EMAIL' => 1, 'PRT' => 1, 'FONCTION' => 1, 'COMMENTAIRE' => 0, 'ARCHIVE' => 0); $vars = verif_champs($champs, 'CTC_'); if (is_array($vars)) { $vars['CLI_NO'] = $vars['CTC_CLIENT']; $vars['FCT_NO'] = $vars['CTC_FONCTION']; unset($vars['CTC_CLIENT'], $vars['CTC_FONCTION']); $query = creer_update($vars, 'CONTACT_CLIENT', "CTC_NO=" . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_libdocument($recherche) { $champs = array('DOCNO' => 1, 'ORDRE' => 1, 'NOMD' => 1, 'CONTENU' => 1, 'COL' => 0); $vars = verif_champs($champs, 'LDO_'); if (is_array($vars)) { $vars['DOC_NO'] = $vars['LDO_DOCNO']; $vars['LDO_NOM'] = $vars['LDO_NOMD']; $vars['COL_NO'] = $vars['LDO_COL']; unset($vars['LDO_DOCNO'], $vars['LDO_COL'], $vars['LDO_NOMD']); $query = creer_update($vars, 'LIBDOCUMENT', "LDO_NO=" . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modifier", "recherche", $_POST['urlRetourMAJ']) . "?iddoc=" . $vars['DOC_NO'] . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_collaborateur_externe($recherche) { $champs = array('FOURNISSEUR' => 1, 'NOM' => 1, 'PRENOM' => 1, 'ETAT' => 0, 'ARCHIVE' => 0, 'MNEMONIC' => 1, 'CIVILITE' => 1, 'NOMJEUNEFILLE' => 0, 'TEL' => 0, 'PRT' => 1, 'EMAIL' => 0); $vars = verif_champs($champs, 'COL_'); if (is_array($vars)) { //TODO : vérifier, il manque peut être un unset($vars['COL_NO']); $externe = array('FOU_NO' => $vars['COL_FOURNISSEUR']); unset($vars['COL_FOURNISSEUR']); $query = creer_update($vars, 'COLLABORATEUR', 'COL_NO=' . $recherche); $GLOBALS['connexion']->query($query); $query = creer_update($externe, 'EXTERNE', 'COL_NO=' . $recherche); $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $vars; } header('Location:' . $url); }
function update_projet($recherche) { $champs = array('CLIENT' => 1, 'NOM' => 1, 'CTF' => 0, 'CTC' => 0, 'DTDEBUT' => 1, 'DTFINPREVUE' => 0, 'NUMCMDE' => 1, 'NBJOURS' => 0, 'COL' => 0, 'DETAIL' => 1, 'SUIVIPAR' => 1, 'MODALITE' => 0, 'ARCHIVE' => 0, 'DTCLOTURE' => 0, 'NO' => 0); $champ2 = array('MISNOM' => 1, 'MISNUMCMDE' => 1, 'MISDATECMDE' => 1, 'MISDTDEBUT' => 1, 'MISDTFIN' => 1, 'MISNBJOURS' => 0, 'MISFORFAIT' => 0, 'MISMONTFORFAIT' => 0, 'MISTJM' => 0, 'MISPA' => 0, 'MISNO' => 0, 'MISCOMMENTAIRE' => 0, 'MISORDRE' => 0, 'PRONO' => 0); $vars = verif_champs($champs, 'PRO_'); if (is_array($vars)) { $vars['CLI_NO'] = $vars['PRO_CLIENT']; $vars['CTF_NO'] = $vars['PRO_CTF']; $vars['CTC_NO'] = $vars['PRO_CTC']; $vars['COL_NO'] = $vars['PRO_COL']; unset($vars['PRO_CLIENT'], $vars['PRO_CTF'], $vars['PRO_CTC'], $vars['PRO_COL']); $query = creer_update($vars, 'PROJET', 'PRO_NO=' . $recherche); $GLOBALS['connexion']->query($query); $var2 = verif_champs($champ2, ''); if (is_array($var2)) { $var2['MIS_NOM'] = $var2['MISNOM']; $var2['MIS_NUMCMDE'] = $var2['MISNUMCMDE']; $var2['MIS_DATECMDE'] = $var2['MISDATECMDE']; $var2['MIS_DTDEBUT'] = $var2['MISDTDEBUT']; $var2['MIS_DTFIN'] = $var2['MISDTFIN']; $var2['MIS_NBJOURS'] = $var2['MISNBJOURS']; $var2['MIS_SUIVIPAR'] = $var2['MISSUIVIPAR']; $var2['MIS_FORFAIT'] = $var2['MISFORFAIT']; $var2['MIS_MONTFORFAIT'] = $var2['MISMONTFORFAIT']; $var2['MIS_TJM'] = $var2['MISTJM']; $var2['MIS_PA'] = $var2['MISPA']; $var2['MIS_COMMENTAIRE'] = $var2['MISCOMMENTAIRE']; $var2['PRO_NO'] = $var2['PRONO']; $var2['MIS_ORDRE'] = $var2['MISORDRE']; $idmission = $var2['MISNO']; unset($var2['MISNO'], $var2['PRONO'], $var2['MISORDRE'], $var2['MISNOM'], $var2['MISNUMCMDE'], $var2['MISDATECMDE'], $var2['MISDTDEBUT'], $var2['MISDTFIN'], $var2['MISNBJOURS']); unset($var2['MISSUIVIPAR'], $var2['MISFORFAIT'], $var2['MISMONTFORFAIT'], $var2['MISTJM'], $var2['MISPA'], $var2['MISCOMMENTAIRE']); if ($idmission > 0) { $query = creer_update($var2, 'MISSION', "MIS_NO=" . $idmission); } else { $var2['PRO_NO'] = $recherche; $query = creer_insert($var2, 'MISSION'); } $GLOBALS['connexion']->query($query); $url = str_replace("modification", "affichage", $_POST['urlRetourMAJ']) . "&recherche=" . $recherche . "&message=MAJOK"; unset($_POST); $_POST['recherche'] = $recherche; } else { return $var2; } } else { return $vars; } //header('Location:' . $url); ?> <script> document.location.href = '<?php echo $url; ?> '; </script> <?php }