# Learn & Place India — Branch Manager Update

12 October 2026 · Staging release · Existing PHP website patch

यह नया पूरा website backup नहीं है। यह आपकी भेजी हुई `_integration-backups (4).zip` + ऊपर से `admin (3).zip` वाली code baseline का update है। Database dump इन archives में नहीं मिला; live data और current hosting configuration की जाँच इस पैकेज से संभव नहीं हुई है।

## क्या बदला

- Admin: Branches & Managers screen; branch बनाना, employee को manager बनाना, View/Add/Edit/Export module permissions, सभी branches का data और branch filter, manager द्वारा बनाए employees की count और audit log।
- Manager: उसी Employee Login से Manager Workspace। अपने branch में employee login/password बनाना; admin की दी permissions के अनुसार branch records manage करना। Manager दूसरे manager को create/promote नहीं कर सकता।
- Modules: employees, jobs, job applications, candidate accounts, employee candidates, resumes, training programs, program enrollments, training applications, classes, employee attendance, candidate attendance, tasks, reports, follow-ups, invoices/payment history, resources, reviews, announcements। Report modules read-only हैं। Employee attendance में manager remarks बदल सकता है; check-in/out proof नहीं।
- पुराने global employee module views की जगह scoped Manager Workspace मिलता है। Employee का अपने records वाला CRM/invoice/payment/report workflow बना रहता है।
- Resume list: name/mobile/email/applied jobs + View Resume। Applications email से match होते हैं; managers को केवल अपने branch में assigned applications के matches दिखते हैं।
- Class Join schedule के बाहर बंद रहता है; end time पर portal में Live/Join हटता है। Candidate attendance report, manager report और admin report एक ही attendance table उपयोग करते हैं। आज खत्म हुई classes भी candidate percentage में शामिल हैं।
- Website Control → Announcements: poster/message/link, IST schedule, session/daily/always frequency, animated popup और preview। Managers को यह permission देने पर उनका approved Active announcement पूरे homepage पर दिखेगा।
- Resources: Mock Interview, Mock Test, Academic Material (stored as Study Material), Video/Class, Other। Resources limit 100 MB, review video 50 MB, poster 5 MB; PHP/server limits भी लागू होते हैं। Failed uploads अब error दिखाते हैं; hosting limits अपने-आप नहीं बढ़ते।

## पहले staging, फिर live

1. **Current live files + पूरा database SQL backup लें।** आपका भेजा code archive SQL data backup का विकल्प नहीं है। Hosting का पुराना account/data delete करने की अनुमति न दें।
2. एक private staging subdomain पर live site और database की अलग copy बनाएँ। Staging की `db.php` सिर्फ staging database से जुड़ी हो। Outgoing email staging mailbox पर रखें; real candidates को test mails न भेजें।
3. `BASELINE-SHA256.txt` में जिन old files के hashes हैं, उन्हें current live files से compare कराएँ। Live में बाद के changes हैं तो उनका merge करें; यह patch ऊपर से blindly overwrite न करें।
4. ZIP के **public_html के अंदर के files/folders** को staging document root में उसी relative location पर merge करें। पूरा folder replace/delete न करें। `db.php`, mail config और पुराने uploads इस ZIP में नहीं हैं; existing ones ही रहें। `tools` और ये docs public web root के बाहर रखें।
5. PHP **8.0+**, PDO MySQL, Fileinfo, sessions और InnoDB tables चाहिए। पहले existing Admin employee/training/classes/resources/reviews pages खोलें ताकि original module tables मौजूद हों। फिर admin login के बाद `/admin/branches.php` खोलें। यह सिर्फ छह नए `lpi_*` tables बनाता है; कोई existing table drop/truncate नहीं करता।
6. Main Admin → Branches & Managers: branch बनाएँ → Employees से employee login बनाएँ → Overview में employee को Manager role और branch assign करें → manager permissions में View और जरूरी Add/Edit/Export tick करें। **सभी existing employees को सही branch assign करें।** Existing candidate accounts, jobs, applications, programs, classes, resumes आदि को भी सही branch assign करें। Unassigned records नए manager workspace में Admin-only रहते हैं।
7. Manager login `/employee-panel/login.php` → Manager Workspace (`/employee-panel/branch.php`)। Manager केवल ordinary employee credentials बना सकता है। Program enrollment के लिए candidate account और training program दोनों उसकी branch में assigned हों। Employee CRM candidate और portal candidate account अलग existing tables हैं; ये अपने-आप merge नहीं होते।
8. Existing invoice/onboarding email process Employee Panel में ही चलता है। Manager Workspace का CRM edit existing records manage करता है; नया invoice+candidate original workflow से बनाएँ। Invoice/payment history manager को read-only दी जा सकती है।
9. Announcement test: `/admin/branches.php?module=announcements` में draft बनाकर Preview देखें। फिर सही schedule के साथ Active करें। Homepage `/index.php` होना चाहिए; अगर hosting `index.html` serve कर रहा है तो support से सही DirectoryIndex confirm कराएँ। पुराने HTML को बिना जाँच delete न करें।
10. Hosting MultiPHP INI Editor में `upload_max_filesize=100M`, `post_max_size=128M`, पर्याप्त `max_execution_time`/`max_input_time` और upload folders की write access verify करें। Server/proxy/WAF की request limit भी 100 MB upload स्वीकार करे। `tools/php-upload-settings.example.ini` सिर्फ values का example है—existing configuration overwrite न करें। Review video limit application में 50 MB ही है।
11. Terminal से `php tools/validate.php /path/to/update/public_html` चलाएँ। फिर **STAGING-TESTS.md** का matrix पूरा करें। यह environment PHP/MySQL नहीं चला पाया; runtime/syntax lint और real upload/mail checks अभी staging पर आवश्यक हैं।
12. सभी tests pass होने पर short maintenance window में verified files merge करें, पहले fresh backup लें और फिर admin page से additive tables initialize करें। इस update के लिए DNS/domain/hosting migration आवश्यक नहीं है।

## जरूरी सीमाएँ

- Portal tracking Google Meet/Zoom attendance verification नहीं है। Candidate tracking tab open रखने पर heartbeat से समय जुड़ता है; 90 सेकंड से लंबा gap count नहीं होता। External meeting को provider पर forcibly end नहीं किया जाता। Provider-verified attendance के लिए अलग authorized API/webhook integration चाहिए।
- Manager records branch-specific हैं; jobs/reviews/resources अपने existing public publication/enrollment rules से दिखते हैं। Existing public upload URLs को इस patch ने private file storage में नहीं बदला है।
- User-submitted job applications/resumes खुद branch guess नहीं करते; admin उन्हें assign करता है। इससे गलत branch में personal data जाने से बचता है।
- यह full security audit या live compatibility certificate नहीं है। पुराने unrelated endpoints, hosting, SMTP, actual database schema/data और current live modifications की staging में जाँच जरूरी है।
- Current passwords/account IDs बदले नहीं गए हैं। Existing DB/mail configuration package में शामिल नहीं है।

## Rollback

File error हो तो maintenance mode में केवल इस package से बदली files का pre-update backup वापस रखें और नई files हटाएँ। छह additive `lpi_*` tables को तुरंत drop न करें। Branch workspace से की गई employee/job/enrollment edits existing tables में रहती हैं; file rollback उन्हें undo नहीं करता। Database rollback से पहले नए candidate/application records सुरक्षित कराकर support से reconciliation करें। Old snapshot से live database blindly restore न करें।
